Quote:
|
Originally Posted by BradAMiller
EasyC has a block built in for the VEX/Daventech ultrasonic sensor. The help file tells how to connect it. EasyC will return the distance in inches. The Ultrasonic sensor can be: - Started: the sensor starts pinging and computing the distance to the nearest object in its field of view.
- Stopped: where the pinging is stopped
- Get: where you read the most recent distance that it measured is returned to your program.
You use the same block for each of those operations. When you drag the block into the program select the option that you want. In the case of Get you need to supply a variable for the result.
The way it works (internally) is that one connection goes to a digital output and the other to an interrupt pin (digital inputs 1-6). The sensor is sent a pulse on the digital output that causes it to transmit a burst of ultrasonic sound. When the sound reflects off of an object, it returns and causes a signal on the digital input (interrupt) pin. EasyC computes the round trip time of the sound and converts that time to inches based on the speed of sound.
|
Man... EasyC really does take all the fun* out of coding...
Anyways, thanks for your help Brad.
-Dillon
*By fun I mean sleepless nights of checking syntax and stressful days of trying to write an autonomous a day before ship, when you've finally gotten your hands on the robot for more than 5 minutes.