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 ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.