1 / 13

Value Control with Variables

Value Control with Variables. Joe Long Robofest Student Assistant Lawrence Tech Computer Science Major jl0109@gmail.com April 12, 2007. Create the variable. Navigate to the ‘Edit’ menu (next to ‘file’) Click on ‘Define Variables’ Click ‘create’ and enter the variable information

waite
Download Presentation

Value Control with Variables

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Value Controlwith Variables Joe Long Robofest Student Assistant Lawrence Tech Computer Science Majorjl0109@gmail.com April 12, 2007

  2. 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’

  3. Getting the light value • Open the ‘complete’ block menu ( ) • Find a Light Sensor block and drag it onto the field.

  4. 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.

  5. 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:

  6. 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:

  7. 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:

  8. 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’

  9. 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.

  10. 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:

  11. 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.

  12. 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.

  13. Complete Steps: • Read the light value • Save it to a variable • Do…. Whatever comes in-between… • Read the variable • Do any required math • Convert the number to text • Display the text • Wait some time before continuing

More Related