Program

To start, drag out a math block (set to subtract) and a variable block. Both are found under the red data operations tab of the programming palate:

A variable is a placeholder for a value. They have two operations: write, which changes the value stored in the variable, and read, which retrieves the stored value. This means that variables are a convenient way to save a value in one part of a program to use it in another part of the code. In the EV3 software, variables can store three types of data: numeric, logic, and text.

A variable must be defined before we can use it in the program. The first step is to choose the data type. By ...

Get Building Smart LEGO MINDSTORMS EV3 Robots 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.