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

Other bang-bang controllers


In the following graphical program, instead of the Color Sensor, a Gyro Sensor is used to control the zones. One major difference you may notice is the discreteness of this graph. This is because the Gyro Sensor readings are not continuous but are only measured to the nearest degree. In this case, I spaced the circle and star zones two degrees apart. From the graph, you can see that the robot started to oscillate around the rectangular zone, but eventually settled down.

In this graphical program, as you can see from the programming panels in the following screenshot, the robot is attempting to drive at a given angle. In the star zone, the robot will turn to the right, in the circle zone it will turn to the left, and in the rectangular zone it will drive straight. Another distinct advantage of using a graphical program is the trouble with negative numbers. From the default position of zero degrees, if a robot turns to the left, the Gyro Sensor will present a negative...