Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   Ultrasonic Distances (http://www.chiefdelphi.com/forums/showthread.php?t=46969)

irishninja 30-04-2006 17:10

Ultrasonic Distances
 
What is the analog number for 1 foot for the ultrasonic sensor?

foobert 30-04-2006 20:25

Re: Ultrasonic Distances
 
the ultrasonic sensor does not return an analog value. it returns the time it takes sound to make a round trip out from the sensor to whatever's out there and back to the sensor. the distance can be had by multiplying that time by the speed of sound through air. you need to know the scale of the units returned by the routine that reads the sensor. microseconds, milliseconds, whatever.

or you can put something a foot in front of the sensor and see what kind of reading you get. note that there will be a little jitter, so you'll want to average a couple of different readings and then rather than comparing future readings to the value you get, check to see if they're close. for instance...

if ((new_reading >( one_foot - fudge_factor)) and (new_reading < (one_foot + fudge_factor))) {...

or you could wait for a reply from someone who's used easyC

Quote:

Originally Posted by irishninja
What is the analog number for 1 foot for the ultrasonic sensor?



All times are GMT -5. The time now is 12:41.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi