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

conclusion

The flow of your program is as important as the configuration of the blocks. You use the Switch block to make decisions, allowing you to choose between two groups of blocks. By nesting Switch blocks, you can extend the number of choices, as in the LineFollower2 program.

The other major flow control block is the Loop block, which allows you to repeat a group of blocks until a certain condition is reached. Much of the power of the NXT-G language comes from the flexibility you have in specifying the conditions for both of these blocks. The condition is usually based on a sensor reaching a set trigger value, although you can also configure the Loop block to repeat for a certain number of repetitions or a set amount of time.

You can also use ...

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