
Copyright © Parallax Inc. Page 6 of 6
}
long RCTime(int sensorIn){
long duration = 0;
pinMode(sensorIn, OUTPUT); // Make pin OUTPUT
digitalWrite(sensorIn, HIGH); // Pin HIGH (discharge capacitor)
delay(1); // Wait 1ms
pinMode(sensorIn, INPUT); // Make pin INPUT
digitalWrite(sensorIn, LOW); // Turn off internal pullups
while(digitalRead(sensorIn)){ // Wait for pin to go LOW
duration++;
}
return duration;
}
Note: To view the results of the demonstration, after uploading is complete click the Serial
Monitor icon in the Arduino IDE. This displays the Serial Monitor window. Momentarily
depress the Reset button on the Arduino board to restart the sketch.
Note: Depending on surface reflectivity, values will range from about 40 to 1300.
For More Information
•Visit the full documentation for the QTI Sensor (#555-27401), available from its product page.
•The QTI Line Follower AppKit (#28108) contains four QTI sensors, plus mounting hardware to
attach to the BOE-Bot robot chassis, and is specifically designed to provide line following
capability.
•The Infrared Line Follower Kit (#28304) is a single module with eight integrated infrared sensors,
and is also designed to provide line following capability to the BOE-Bot robot chassis.