Skip to Main Content
The Art of LEGO MINDSTORMS NXT-G Programming
book

The Art of LEGO MINDSTORMS NXT-G Programming

by Terry Griffin
August 2010
Intermediate to advanced content levelIntermediate to advanced
288 pages
13h 21m
English
No Starch Press
Content preview from The Art of LEGO MINDSTORMS NXT-G Programming

matching more than two values

The Switch block in the LogicToText program uses the logic value from the Touch Sensor block to choose between two options. This works great with a logic value because it can have only two possible values (either true or false). But what if you want to choose from more than two options? If so, you’ll need to use either a number value or a text value, since these data types can have more than two values.

When using a number or text value with a Switch block, you create a list of values to match against, one for each choice you want the program to make. Figure 9-15 shows the Configuration Panel for a Switch block that has been configured to choose between three numbers: 10, 25, and 75.

Figure 9-15. Configuration Panel ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

Terry Griffin

Publisher Resources

ISBN: 9781593272180Errata