#include Servo right_motor,left_motor; // create servo object to control a servo void setup() { right_motor.attach(11); // Attaches the servo on pin 11 left_motor.attach(12); // Attaches the servo on pin 12 } void loop() { // Compare it with reference if (digitalRead(10)==0) { // If TRUE left_motor.write(0); // Reverse one motor delay(750); // Wait until turn is enough } right_motor.write(0); // Drive forward left_motor.write(180); // Drive forward }