Chapter 9. data wires and the switch block

You can use the Switch block 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 Infrared 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 based on a value supplied by a data wire. 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 modes

Up until now, you’ve used the Switch block to take a sensor measurement and make a decision based on that measurement. The Switch block can ...

Get The Art of LEGO MINDSTORMS EV3 Programming (Full Color) now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.