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

Chapter 11. variables

The previous three chapters explored using data wires to move data between blocks in your program. Although this ability can be very useful, for some problems you need to do more than just move data around. Often you’ll need to tuck the information away and use it later in your program.

When you need to store information for later use, use a variable. In this chapter, I’ll show you how to use variables and the types of problems they can help you solve.

a place for your data

Think of a variable as a place in the NXT’s memory where you can store a value. The programs in this chapter will show you several ways that you can use variables in your programs.

The first example program in this chapter is a modified version of the RedOrBlue ...

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