Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementing Variables in Your Programs

Similar presentations


Presentation on theme: "Implementing Variables in Your Programs"— Presentation transcript:

1 Implementing Variables in Your Programs
Containers Implementing Variables in Your Programs

2 Basics Containers in Robolab are like variables Store values
Change values Use when the value can change

3 Initialization The first thing you need to do to any container is clear it. Red, Blue, Yellow Sets value to 0

4 Filling the Container Any color container Any value you want

5 Simple Math Add, Subtract, Multiply, Divide Red Symbols on the icon
Use any value to divide into, subtract from, etc.

6 Sensor Values Any sensor’s value Specify Value of Port number
Make sure the graphic is the right sensor

7 Example This program reads the value of the light sensor then
adds 20, divides by 5, and runs motor A for the resulting number of seconds.

8 Timers Even timers can be used Specify the timer color

9 Wait for Value Will not continue until the value of the container is exactly 78 Any number or container will do

10 Using Container Values
The value can be referenced using the value of container icon Anything that uses a value can take a value of container

11 Container Fork Uses the value in the container Compares it to a value
If the value of the container is greater than 100, take the upper route, else take the lower.

12 Another Example using a fork
This program goes forward for a random number of seconds, counts the number of ticks with the rotational sensor (16 per revolution), determines how many centimeters this is, then if it’s more than 30, it goes back for 4 seconds, and if it’s less, it goes forward. **The container is used to decide how many centimeters the robot has traveled**

13 Confused? If you have any more questions, or if you just don’t get it, and want to TELL SOMEONE. We’ll be around, and we’ll be happy to explain things further 


Download ppt "Implementing Variables in Your Programs"

Similar presentations


Ads by Google