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 the false case? Well, nothing! We will leave this case empty because if the turret is not squarely aimed at the beacon, it should not launch any projectiles. So, we do not have to tell it to do anything!

Your completed fire case should look like this:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.198.43