Follow a Line and Return (Hint)

Home > Activities > Robots > Examples

Computer Challenge logo

 

  Equipment
  Building
  Programming
  Missions
Examples
  Contests
  Links
  Award

 

Action: Follow a line using one light sensor. When the robot bumps into something, turn around and return along the line.

Robot: Light sensor in the front pointing down and connected to input 2. Touch sensor attached to a front bumper and connected to input 1.

Reading the program

  • Begin the program
  • Begin a loop (red land)
  • Read the light sensor connected to input 2
    • If the value read is greater than 40:
      • (Turn left) - your code here
    • If the value read is less than or equal to 40:
      • (Turn right) - your code here
  • Merge
  • Read the touch sensor connected to input 1
    • If it is pushed in:
      • (Back up, turn around) - your code here
    • If it is not pushed in:
      • Continue to the next step
  • Merge
  • Loop to the red land (red jump)
  • End the program

Where to find it

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

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


  © 2010 Computer Challenge