Setting up the switch

At the heart of the beacon check-step is a switch block. The program reads IR 2 to see whether a beacon is nearby. Then, based on the result, the robot will execute one of two cases.

Drag out an IR sensor block and insert it inside of the loop. Set the sensor block's mode (in the bottom-left corner of the block) to Measure | Beacon. The channel number of the beacon that the program will look for is set to channel 1 by default. There is no need to change this unless you want the program to work on a different channel. Whichever channel you choose, make sure that the channel chosen in the program matches the channel selected on the remote control.

Next, drag out a switch block and place it after the IR sensor block. By ...

Get Building Smart LEGO MINDSTORMS EV3 Robots 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.