Purpose: This Program Tests The Sensors & Trains Students how to Program with Operators using "<"  ">" 

 Tilt your robot upright so that the Line sensors are not pointing at the ground.

  Line sensors actually are not seeking colors, but are determining the Reflectivity of an object.
Note: "Reflectivity > 50" is Bright (White is considered Bright) &
" Reflectivity < 50" is Dark (Black is considered Dark). 



 

   

Your Task: You will create a different code sequence for each Line Tracker. If Left Sensor touches White, it should move Left. If the Right Sensor touches White, it should move Right.
Now create a program using the code structure image to the right.

Look at the previous code you have written to have your robot move forward and add it to your code.

Then, add an Operator that will trigger an "If/Then" statement to turn right if one of the two sensors touches White and then add another Operator to the other "If/Then" statement that will have the other motor turn left if the other sensor touches White. Note: the code that triggers the If/Then statement when the line sensor touches white is provided to you above.

Hint! If both the Left and Right Motors are rotating forward at 30%, the robot will drive straight. If you want the robot to turn left, then slow the left motor down (5%) and maintain the same speed for the Right Motor. Vice Versa, if you want the robot to turn right, slow the Right Motor down to 5% and maintain the same speed for the left Motor.  Now apply this hint to the "Then" portion of your code, test and make changes until it works. 

Key To Your Robot's Success...Program your robot so that it drives slowly!

Test Your Program.          
Lift a white object to the Left or Right Line Sensors (I have a white object for you to use). What happened? Did it work correctly?

Compare your Program  
Keep refining your code. When you finally succeed, compare your code to my code.