View Single Post
  #12   Spotlight this post!  
Unread 19-02-2010, 08:19
Foster Foster is offline
Engineering Program Management
VRC #8081 (STEMRobotics)
Team Role: Mentor
 
Join Date: Jul 2007
Rookie Year: 2005
Location: Delaware
Posts: 1,392
Foster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond repute
Re: Sonar Sensors legal

Sorry to confuse you.

In the packet they give you a sample of code using Basic on how you would use the sensor. You can see how they read the value from the Analog to Digital Converter (like our cRio analog card) and convert it to distance.

The formula for the Sharp 2Y0AD21 sensor is:
DistanceToObject = (3027.4 / IRVALUE) ** 1.2134

In my prior message where I said to take a number of samples at different distances and create the formula what I was saying is at the end you'll have a formula like above to calculate the distance.

The sensor is easy to use, plug it into an analog port on your cRio. You'll need to make it work, so it's not 100% plug-and-go, but in under 15 minutes you should be able to figure it out.

Chapter 12 of the FRC Labview Manual has the VI information. You can use GetVoltage.vi, but you might be happier with the GetAverageVoltage.vi. (Dont forget Open.vi to open the channel!)

Good luck!
__________________
Foster - VEX Delaware - 17 teams -- Chief Roboteer STEMRobotics.org
2010 - Mentor of the Year - VEX Clean Sweep World Championship
2006-2016, a decade of doing VEX, time really flies while having fun
Downingtown Area Robotics Web site and VEXMen Team Site come see what we can do for you.