|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#5
|
|||
|
|||
|
Re: Ultrasonics / Sonar
Hey, I'm working with Nate (who started this thread) on the code and here's what happens:
In the class variables declaration: Ultrasonic *m_ultra; double range; static const UINT32 pingChannel=1; static const UINT32 echoChannel=2; In the constructor: m_ultra = new Ultrasonic(pingChannel, echoChannel); m_ultra->SetAutomaticMode(true); range = m_ultra->GetRangeInches(); But when I print out the range I get only zeros. Actually, I've gotten other values with that code occasionally (still not functional though, just random values that don't update often at all), but we tested so many sensors and configurations that I am not convinced it is a hardware problem. Also, I can't get that sample code from the Programming Guide to work. I get compiler errors. I've tried a number of things, but unless i use that code with pointers, I can't get the code to compile. So can anyone give some sample code, or detailed instructions, on how they set up their ultrasonic sensors? |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sonar is being lame | Sparky_68 | Programming | 5 | 13-02-2009 00:55 |
| How to program sonar | FearlessLeader | C/C++ | 1 | 11-02-2009 22:39 |
| Sonar Sensor help | eagleslg | Programming | 9 | 05-05-2008 21:14 |
| Ultrasonics | Ctx32 | Programming | 1 | 06-06-2006 10:56 |
| Ultrasonics | Ctx32 | FIRST Tech Challenge | 3 | 06-05-2006 14:32 |