|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Ultrasonic sensors on digital ports 3-6 problems
I wrote a program to run this sensor (Parallax PING))) ) for ports 1&2, and it worked fine, but I decided I would rather have them on ports 3-6 and have 1&2 for my encoders, so I re-wrote my code, and now it doesn't work properly. I end up getting one high number when I first turn on the robot, then a steady number of 35 for the distance and 25 for the time. Here is my code:
http://www.easternfront.org/ultrasonic_port_3_6.zip I had several printf's spread around in it to see if I was getting to all of the places in my code, thats what that phasetest is. My implementation of it in the default routine is: Code:
if(x==1)
{
Ping(3);
}
if(x==20)
{
printf("Distance:%d Time%d\r",Get_Distance(3),Ultrasonic_3_Time);
x=0;
}
x++;
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Parallax and Maxbotix ultrasonic sensors | Lucretius | Programming | 5 | 02-20-2008 02:34 PM |
| ultrasonic sensor problems... | couldntthinkofa | Programming | 2 | 01-05-2008 12:29 PM |
| Ultrasonic range sensors for Vex Robot | OneCoolDude | Programming | 1 | 12-01-2007 09:22 AM |
| can we use ultrasonic sensors? | GMKlenklen | Electrical | 20 | 01-15-2007 02:34 PM |
| Gryo, Camera, Accelorometer, Ultrasonic, and Gear Tooth Sensors in one program | EHaskins | Programming | 8 | 05-22-2006 12:08 PM |