void soft_right_2_degrees(unsigned int Degrees) { // 176 pulses for 360 degrees rotation 2.045 degrees per count soft_right_2(); //Turn reverse soft right Degrees=Degrees*2; angle_rotate(Degrees); }
//Main Function int main() { init_devices(); velocity (100, 100); //Set robot velocity here. Smaller the value lesser will be the velocity //Try different valuse between 0 to 255 while(1) { forward(); //both wheels forward _delay_ms(1000); stop(); _delay_ms(500); back(); //both wheels backward _delay_ms(1000); stop(); _delay_ms(500); left(); //Left wheel backward, Right wheel forward _delay_ms(1000); stop(); _delay_ms(500); right(); //Left wheel forward, Right wheel backward _delay_ms(1000); stop(); _delay_ms(500); soft_left(); //Left wheel stationary, Right wheel forward _delay_ms(1000); stop(); _delay_ms(500); soft_right(); //Left wheel forward, Right wheel is stationary _delay_ms(1000); stop(); _delay_ms(500); soft_left_2(); //Left wheel backward, right wheel stationary _delay_ms(1000); stop(); _delay_ms(500); soft_right_2(); //Left wheel stationary, Right wheel backward _delay_ms(1000); stop(); _delay_ms(1000); } }
//Main Function int main() { init_devices(); while(1) { forward(); //both wheels forward _delay_ms(1000); stop(); _delay_ms(500); back(); //bpth wheels backward _delay_ms(1000); stop(); _delay_ms(500); left(); //Left wheel backward, Right wheel forward _delay_ms(1000); stop(); _delay_ms(500); right(); //Left wheel forward, Right wheel backward _delay_ms(1000); stop(); _delay_ms(500); soft_left(); //Left wheel stationary, Right wheel forward _delay_ms(1000); stop(); _delay_ms(500); soft_right(); //Left wheel forward, Right wheel is stationary _delay_ms(1000); stop(); _delay_ms(500); soft_left_2(); //Left wheel backward, right wheel stationary _delay_ms(1000); stop(); _delay_ms(500); soft_right_2(); //Left wheel stationary, Right wheel backward _delay_ms(1000); stop(); _delay_ms(1000); } }