In this episode we combine in a single program the previous two programs for moving forward and backward.
- 04 Mar 2017
The code for moving forward is:
motor[port3] = 50
The code for moving backward is using the same instructions, but using -50 for power of the motors.
In this video we'll combine the previous two programs to make the robot move forward and then backward.
As the program is getting longer I'll just zoom out. And here what we need to do is I'll just copy this code where we have the move, move forward and just set -50 here and -50 here. So, it's actually the same logic as the previous two programs. Here we are just moving forward and here we are moving backward. And we are waiting for one second here. And one second here. If we now download the program and run it we'll see the robot moving forward and backward.