Book Image

Learning Lego Mindstorms EV3

By : Gary Garber
Book Image

Learning Lego Mindstorms EV3

By: Gary Garber

Overview of this book

Table of Contents (19 chapters)
Learning LEGO MINDSTORMS EV3
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
10
Other Programming Languages
Index

Loop and the Motor Rotation sensors


Let's start by using dead reckoning to drive in a square. As you can see in the following screenshot, we will first use a Loop block from the Flow Control palette and select the Count mode for the Loop block. We can have the robot repeat this turning sequence several times. Inside this loop, the Move Steering block will tell the robot to move forward for one rotation of the wheels. We will then have a Move Steering block that will turn the robot. Remember that a 500-degree turn of the motor shaft is not equivalent to a 500-degree turn of the entire robot.

This is a 500-degree turn of the motor shaft and the wheels, which I chose based on the design of the skid-bot. Depending on which robot design you chose to use, you will need to vary the value that the rotation sensor uses to trigger the stop of the turning motion to approximate a 90-degree turn. If you use any of the other robots from Chapter 3, Drive Train and Chassis (such as the caster-bot or the...