Week 2 - Section 2 - Using Variables and Detecting Obstacles

In the first week we will learn about the edison robot, its capabilities, sensors and communication with the software. We will also learn how to use the EdWare, the software for programming edison robots.

Chapter 5.1 - Variables

A variable is small piece of computer memory for storing data. What makes variables so useful is that this data can change while the program is running, hence the name variable.

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.

To create a variable click on "Add variable" button and then name the variable with the name count. 




Now we are going to use the variable in a loop. 

variables

Now for an exercise try to move the robot backward and forward three 2 times using a variable and a loop.

If you are not sure you can view the image here