Light Sensor Fork with Loop

Home > Activities > Robots > Examples

Computer Challenge logo

 

  Equipment
  Building
  Programming
  Missions
Examples
  Contests
  Links
  Award

 

wait for touch diagram

Action: If the light sensor is seeing bright play a rising sweep sound. If it is seeing dark play a falling sweep sound. Runs continuously.

Reading the program

  • Begin the program
  • Begin a loop (red land)
  • Read the light sensor connected to port 1
    If the value read is greater than 40:
    • Play sound 4 (rising sweep)
If the value read is less than or equal to 40:
    • Play sound 3 (falling sweep)
  • Merge
  • Loop to the red land (red jump)
  • End the program

Where to find it

Light Sensor Fork: click Structures wait for buttonthen Forks on the functions palette.

Play Sound: main panel of the functions palette

For more information: See the Follow a Line tutorial or Context Help in RoboLab.


  © 2012 Computer Challenge