March 2019
Intermediate to advanced
312 pages
7h 37m
English
To move the robot backward, we simply need to interchange the HIGH signal with the LOW signal and vice versa. The complete program to move the robot in this way is written inside the RobotMovement.cpp file, which can be downloaded from Chapter03 of the GitHub repository:
digitalWrite(0,LOW); //PIN O & 2 will move the Left MotordigitalWrite(2,HIGH);digitalWrite(3,LOW); //PIN 3 & 4 will move the Right MotordigitalWrite(4,HIGH);delay(3000);
The first two lines will make the left motor move backward, while the following two lines will make the right motor move backward. The final line indicates that the robot will move for three seconds.