View Single Post
  #6   Spotlight this post!  
Unread 23-01-2008, 21:22
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: Ultrasonic rangefinder code

We aren't using EasyC or WPILIB, but we have used the Maxbotic sensor using analog with good results. The current models use a 9.8mV to an inch scaling.

The code was simple as well.
Here's a sample for it that I just typed from memory using analog port 1:

Code:
unsigned int sonic;
unsigned int mV;
unsigned int inches;
sonic = Get_Analog_Value(rc_ana_01);
mV =( (sonic * 5000) / 1024 );
inches = mV * 10 / 98;
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics



Last edited by Phalanx : 23-01-2008 at 21:24.