Day 2 - Section 2 - Using Variables and Detecting Obstacles
Chapter 5.1 - Variables
The Edison robot has two types of variables that are called ‘bytes’ and ‘words’. Byte variables can store numbers that range from 0 to 255. Word variables can store numbers that range from -32,767 to +32,767.
Variables store numbers like 10, 106, 1,482 etc. and allow a computer program to do maths, this is something that computers are very good at.
To make variables easy to use, we give them
names. This helps us humans remember what type of information is stored in
them. In EdWare, you can name your variables just about anything you like. You
could name one ‘Fred’, but that might
not be a very helpful name for remembering what type of information is stored
in Fred. A better name might be ‘count’.
This type of name makes it very easy to remember what the variable is used for
and what type of data to find there.
Now we are going to use the variable in a loop.
Now for an exercise try to move the robot backward and forward three times using a variable and a loop.
If you are not sure you can view the image here