Red Rover Bot: Line Following with Infrared

RiQ’s Infrared Sensor

RiQ uses infrared sensors to detect the amount of light reflected from surfaces – it’s the perfect solution for line following or sumo wrestling robot matches when RiQ needs to stay on a dark colored ring!

Features-Infrared-Sensor-100

Infrared Line Following Program

The following program is designed to enable RiQ to follow a dark line using infrared sensors. Please note, Motors AB are set to go ON at the beginning of the program, then it enters a LOOP and they stay on.

How It Works

IF the Infrared Sensor on port 0 senses a value smaller than 500, then motor A will go OFF and then ON FOR a fifth of a second to adjust course back onto the line.
IF the Infrared Sensor on port 1 senses a value smaller than 500, then motor B will go OFF and then ON FOR a fifth of a second to adjust course back onto the line.
Important Note: You may need to experiment with the number value, it MAY NOT be 500 depending on the lighting conditions where you are working.