Ultrasonic Rangefinder Forward till Near - ROBOTC.net
Ultrasonic Rangefinder Forward till Near - ROBOTC.net
Ultrasonic Rangefinder Forward till Near - ROBOTC.net
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Sensing<br />
<strong>Ultrasonic</strong> <strong>Rangefinder</strong> <strong>Forward</strong> <strong>till</strong> <strong>Near</strong> (cont.)<br />
Checkpoint<br />
© Carnegie Mellon Robotics Academy / For use with VEX ® Robotics Systems<br />
4b. Select A/D Sensors 1-8<br />
<strong>ROBOTC</strong><br />
4c. Set the sensor Name to “sonarSensor”<br />
The <strong>Ultrasonic</strong> <strong>Rangefinder</strong> is indexed by<br />
the number of the Analog/Digital Port it is<br />
plugged into, so enter a name for the sensor<br />
under Analog/Digital Port in5.<br />
4d. Set the sensor Type to “SONAR”<br />
Set the type of the sensor to “SONAR”,<br />
another name for the <strong>Ultrasonic</strong><br />
<strong>Rangefinder</strong> (because it uses sonar<br />
sound waves to measure distance).<br />
4e. Configure the Second Port to “int1”<br />
When you select “SONAR” as<br />
the sensor Type, a column for the<br />
“second port” appears for this<br />
sensor. The second port is the other<br />
port that the sensor is plugged into,<br />
Interrupt 1 (int1).<br />
4f. Click OK<br />
Click OK to finish configuring<br />
the <strong>Ultrasonic</strong> <strong>Rangefinder</strong>.<br />
The <strong>Ultrasonic</strong> <strong>Rangefinder</strong> is now set up and recognized by the program. It will now provide<br />
sensor readings as values through SensorValue[sonarSensor]. The values represent<br />
distances to the nearest detectable object (the first echo that the sensor hears), in inches. If an<br />
object is 6 inches away, in front of the sensor, SensorValue[sonarSensor] will be 6.<br />
<strong>Ultrasonic</strong> <strong>Rangefinder</strong> • 4