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

grouping common settings

It’s not unusual for a program to use several blocks with the same settings. For example, the WallFollower program contains seven Move blocks that all use the same Power setting. If you decide to change the setting from 35 to 45, you need to make sure you change that setting on all seven blocks. That can become problematic when you’re trying several different Power settings, in search of the perfect balance between speed and accuracy; it’s almost inevitable that you’ll forget to change the setting on one of the blocks.

To avoid this problem, use variables to group common settings. For example, Figure 11-15 shows a modified version of the AroundTheBlock program from Chapter 4. Here you use a variable (named Power) to control ...

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