value control with variables joe long robofest student assistant lawrence tech computer science...
TRANSCRIPT
![Page 1: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/1.jpg)
Value Controlwith Variables
Joe Long
Robofest Student AssistantLawrence Tech Computer Science Major
[email protected] 12, 2007
![Page 2: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/2.jpg)
Create the variable
Navigate to the ‘Edit’ menu (next to ‘file’) Click on ‘Define Variables’ Click ‘create’ and enter
the variable information
and type. Click ‘Close’
![Page 3: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/3.jpg)
Getting the light value
Open the ‘complete’ block menu ( ) Find a Light Sensor block and drag it onto
the field.
![Page 4: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/4.jpg)
Saving the value to a variable
Find a Variable block and drag it onto the field.
In the block’s options panel, change it’s Action to ‘Write’ and select your created variable from the List.
![Page 5: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/5.jpg)
Make the Data Wires(light value saved to a variable)
Click on the ‘tab’ sticking out of the light block ( ), then click on the back ‘tab’ sticking out of the ‘write’ mode variable block
The wire should look
like this:
![Page 6: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/6.jpg)
Read the variable
Drag another variable block onto the field.
In the options panel, select your variable from the list and set the mode to ‘read’.
The block should look like this
When you are done:
![Page 7: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/7.jpg)
Add 2 to the variable
Find the ‘Math’ block and drag it onto the field.
Draw a data wire from the second variable block to the ‘A’ tab on the math block:
![Page 8: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/8.jpg)
Using the math block
Open the math block’s options panel. Set the Operation to ‘Addition’ You can see that the space for ‘A’ is
grayed out, as it is already used. In the ‘B’ space, type in ‘2’
![Page 9: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/9.jpg)
Convert the answer (number) to text for displaying
Find the Number to Text block
Draw a data wire from the ‘#’ tab of the math block to the ‘#’ tab of the conversion block.
![Page 10: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/10.jpg)
Displaying the value
Find the Display block and put it on the field:
In the display block’s options panel, set the Action to ‘Text’ (the location can also be experimented with)
The block should now look like this:
![Page 11: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/11.jpg)
Displaying the value
Open the display block’s drop down menu (by clicking on the line at the bottom edge of the block)
Connect a data cable from the
output of the converter to the
‘T’ tab of the display block.
![Page 12: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/12.jpg)
Display the data for 5 seconds
Find a Wait block and drag it onto the field:
In the options panel, set the Control to ‘Time’ and input 5.
![Page 13: Value Control with Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com jl0109@gmail.com April 12, 2007](https://reader036.vdocument.in/reader036/viewer/2022062618/5514842f550346f06e8b4b42/html5/thumbnails/13.jpg)
Complete
Steps:1. Read the light value
2. Save it to a variable
3. Do…. Whatever comes in-between…
4. Read the variable
5. Do any required math
6. Convert the number to text
7. Display the text
8. Wait some time before continuing