passing data out of a switch block

Passing data out of a Switch block can be a little more complex than passing data in because of the way the wires need to be connected. The LogicToText program shown in Figure 9-9 is a very simple example of passing data out of a Switch block. This program reads the Touch Sensor and writes True on the display if the button is pressed and False if it’s not. Both Sequence Beams inside the Switch block contain a Text block whose output plug is connected to the Display block. The tricky thing here is that the Text blocks on both Sequence Beams need to be connected to the Display block.

The LogicToText program

Figure 9-9. The LogicToText program ...

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.