Skip to Content
Hands-On Robotics Programming with C++
book

Hands-On Robotics Programming with C++

by Dinesh Tavasalkar
March 2019
Intermediate to advanced
312 pages
7h 37m
English
Packt Publishing
Content preview from Hands-On Robotics Programming with C++

Moving the robot backward

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming

Learn Robotics Programming

Danny Staple
C++ Reactive Programming

C++ Reactive Programming

Praseed Pai, Peter Abraham

Publisher Resources

ISBN: 9781789139006Supplemental Content