Program the switch cases

In the true case, we need to add the motor block to make the turret fire. We will add in a medium motor block and select port A. Then, change the mode to On for Degrees. Set the motor's power to 100%; the robot will need the full power of the motor to launch its projectiles. Set the target number of degrees to 600; this is how far the motor needs to rotate to fire two projectiles.

If you find that the tank occasionally fires only one ball instead of two, you may need to increase the target number of degrees. This is because motor A is not rotating far enough to fire two projectiles each time. Conversely, if motor A rotates too far each time, you should decrease the target number of degrees.

What do we program in ...

Get Building Smart LEGO MINDSTORMS EV3 Robots now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.