Motors

Motors let you move your robot.

Display a welcome screen

Let’s write some explanations to the display. It is always good to give the user some hints about what the program is doing. Let’s explain how to use the 3 buttons to control the large motor on port A.

../_images/motor1.png

Move a motor

Now let’s use the buttons to make the motor move.

../_images/motor1b.png

Before downloading the program to the brick, you can test it in the simulation.

../_images/motor1s.png

Change the motor speed

Make a new program called motor2. This time we will include that name in the welcome screen.

We are going to use the up/down button to increase or decrease the speed. For this we will need a variable speed.

../_images/motor2.png

When pressing the up button we increase the speed variable by 10. When pressing the down button we decrease the speed variable by 10.

../_images/motor2b.png

You can try this program in the simulator before you download it to the brick.

../_images/motor2s.png

motor2.uf2