Three-level controller

Now, let's examine a version of this program using the rotation sensor. This program is similar to the previous program except that the angle is set to 400 (the probable rotation of the wheels) and the blocks are set to the rotation sensors instead of the Gyro Sensors. The Gyro program used a two-level controller. A path in the case structure was chosen based on the robot's position relative to a setpoint value. Notice that, in this program, I have a switch within a switch. This allows for a three-level controller. When the robot is actually at the set-point value, no motion takes place.

Three-level controller

In the preceding screenshot, you can ...

Get Learning LEGO MINDSTORMS EV3 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.