Use Lego blocks in SNAP to control Lego Motors
In this lecture you will learn about the SNAP programming blocks developed by Ozeki to control Lego Mindstorms EV3 robot motors. You will find out how to start the motors, how to stop the motors, how to turn them by a given angle and you will learn how to use these blocks in a program you write. If you have not controlled robots from a programming language before, this is the best place to learn the necessary information.
- Ozeki Chopper: http://www.ozeki.hu/index.php?owpn=6202
- Snap basics: http://www.ozeki.hu/index.php?owpn=6180
What is a Snap block? What is it used for?
Snap block - The blocks help you to make your codes in Ozeki 10 Snap (e.g. 'Start motor A'). Snap them together to create algorithms.
Collect all blocks which can start or stop your motor!
In this task you should drag and drop the start and stop motor blocks from the 'Lego motors' category. It is good to know that you can start motor movement or stop them with these blocks. You can select the motor you would like to start and set the motor's speed with the 'Start motor [motors] at [speed]%' block. Keep in mind that all motors you start will continuously rotate, until a stop block is initiated. You can find the stop blocks in the 'Lego motors' section. In it, you can select the motor to stop or you can select all motors. Check the correct blocks for Task #1 in Figure 2.
Figure 2 - Blocks to start and stop motors
Collect the blocks which can rotate your motor!
Here you should find the rotate blocks from the 'Lego motors' category. You can rotate the motors by x° and you can set the rotation speed with a 'Rotate [motors] by [degree]° at [speed]%' block. Select the motors that you would like to rotate or rotate all connected motors. You can find the required Snap blocks for Task #2 on Figure 3. Try collecting the blocks from the 'Lego motors' section.
Figure 3 - Blocks that can rotate your motors
Collect all drive motor blocks to move your motors!
In this task you should collect the drive motor blocks from the 'Lego motors' category. You can drive the Lego vehicle in 4 directions for a limited time. These directions include forward, reverse, right and left. You can set the motor movement time period in secs. You can also set the motor speed. Compare the blocks you have found, with the required blocks you can find on Figure 4.
Figure 4 - Drive motor blocks to move your Lego vehicle in 4 directions
Search for any extra motor blocks you can find!
Keep in mind that you can still learn about a few more blocks (Figure 5). The 1st block selects the Brick to use for the motor commands in the future. The 2nd block sets the motor speed that is stored. Only another 'Set motor speed' command can rewrite it. The 3rd Block can set the motor to a given angle position. The final 4th block is very interesting, because it reads the current angle of a motor, so you can compare it by using operators like >, < or =. You can combine and test them.
Figure 5 - Additional motor blocks designed for Ozeki 10