Chapter 9. data wires and the switch block

The Switch block is used to make decisions about which blocks to run by choosing between two or more alternatives. For example, the WallFollower program in Chapter 7 uses a Switch block that reads the Ultrasonic Sensor and decides whether to move the TriBot toward or away from the wall. In this chapter, you’ll learn how to use the Switch block to make decisions using a value supplied by a data wire, instead of using data directly from a sensor. You’ll also learn how to pass data between the blocks inside the Switch block and the ones that come before or after the Switch block.

the switch block’s value option

The Control setting on the Switch block’s Configuration Panel offers two choices: Sensor and Value. ...

Get The Art of LEGO MINDSTORMS NXT-G Programming 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.