O'Reilly logo

Learning LEGO MINDSTORMS EV3 by Gary Garber

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The control program

The second part of the program, the control loop BHV, has its own Start block, which allows this part of the program to run in parallel to the main programming loop. At the beginning, the st Variable block sets the robot state to 0 or resting. The program then enters the BHV Loop block or the robot behavior loop.

A numeric switch block examines which of the three robot states the robot is in, with 0 for resting state, 1 for waking state, and 2 for the active state. The resting state (state 0) is the default case of the switch block. In this state, the variables blocks Cdrv and Cstr are set to 0. The Cdrv variables block (Control drive) is used to control the speed at which the robot drives either forward or backwards. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required