We just saw how to simplify the program to avoid an obstacle using a My Block (subroutine). Now, we will instead optimize the program using an array, whereas in the LEGO EV3 software, a variable can have one value, an array can have several elements, each with its own value. To learn how an array in EV3 works, you will first need to write a program to display a series of numbers on the EV3 brick screen.
First, clear the display screen. Then define a variable called
Steering. By clicking on the mode selector of the Variable block, we can choose to write to an array instead of writing to a numeric variable. The LEGO EV3 software contains numeric and logic (or Boolean) arrays. It does not currently have arrays for strings (or lists).
We will ...