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

replacing long data wires with variables

Variables can replace really long data wires in your programs. Instead of using a long data wire, you can use a pair of Variable blocks and a variable with a meaningful name. You use the first Variable block to write the value to a variable just after the block that creates the value. Later in the program, you can read the variable using a second Variable block placed next to the blocks that use the value.

When you can see both ends of a data wire, it’s usually easy to understand how it’s being used. When a program becomes too long to fit on the screen or you can’t see where a data wire starts, it’s much more difficult to follow the logic of the program. A short data wire attached to a Variable block (which ...

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