|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Ultrasonic
hey, i'm new to this, and i have just joined programming.... I was wondering if anone was using an ultrasonic rangefinder or if anyone knew how to write the code. I have a ultrasonic that has only 1 port... it's the Ping))) ultrasonic distance sensor from Parallax.... I was using WPILib, but that has both an echo and ping port, and mine has only a connection for one port, and the sample code is in basic, which I don't understand... HELP?! thanks oh, and I am working in C programming.
|
|
#2
|
||||
|
||||
|
Re: Ultrasonic
You can wire it two 2 ports from that one set of 3. I wrote some code for that sensor and it works if one of the pins is in port 1 or 2. I am working now to get ports 3-6 working, but with no luck.
Basically what you have to do is send a pulse on a digital output (set one of them to 1 for a couple of seconds) then you wait for an input, which is where you use an interrupt and a timer to time the pulse. Take a look at the datasheet for that sensor http://www.parallax.com/Portals/0/Do...-PING-v1.4.pdf and if you would like I could upload my code that works with ports 1&2. |
|
#3
|
|||
|
|||
|
Re: Ultrasonic
The WPIlib code works if you use a Y-cable to plug the Ping))) into, say, ports 1 and 7 (the echo port must be one of the first 6). You'll have to convert the male ends of the Y-cable to female.
|
|
#4
|
||||
|
||||
|
Re: Ultrasonic
Will, I was wondering if you could upload your code so I can check it out as well?
I've been trying to get multiple sonars working and I just don't know how! So if you can upload that'd be great, and if anyone else can upload code that they've used to get Multiple sonars working that'd be great! It would really help me and possibly many others! - Rameez |
|
#5
|
||||
|
||||
|
Re: Ultrasonic
I've previously posted my single pin ultrasonic driver.
I also have a quad ultrasonic driver that's not abstracted from the 1024 2008 robot code entirely (as my previous single pin single ultrasonic was). I'll be releasing my quad ultrasonic driver as early as after ship date or as late as mid season. Just to give a few specs, my quad ultrasonic driver (usdriver2.c/h) can read up to four simultaneous measurements from four parallax PING))) (or similar) ultrasonic sensors. They can be fired together or in any combination or sequence at any time (provided the individual sensor is not busy). The system makes use of digital I/O pins 3-6 and is not reconfigureable to any other pins, and also uses TMR1. This, also, is not reconfigureable. If there is enough interest in this driver i'll make it more of a priority. -q |
|
#6
|
||||
|
||||
|
Re: Ultrasonic
My code for port 1 or 2:
www.easternfront.org/ultrasonic_port_1_2.zip I have to get the ones for 3-6 working sometime soon, I cant seem to get it, I have a thread going about my problem here: http://www.chiefdelphi.com/forums/sh...ad.php?t=63081 I shall look over your code Qbranch, thanks for posting After the season when I have some time I will play around with using only 1 port (I had mixed results before) Last edited by wt200999 : 10-02-2008 at 21:02. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ultrasonic rangefinder code | windell747 | Programming | 9 | 25-01-2008 00:37 |
| Ultrasonic will not work with another Ultrasonic plz help | Jackel148 | Programming | 10 | 10-05-2006 15:31 |
| Ultrasonic Distances | irishninja | FIRST Tech Challenge | 1 | 30-04-2006 20:25 |
| Ultrasonic Sensor output | Dillon Compton | Programming | 5 | 03-02-2006 10:20 |
| Ultrasonic Sensor | winners | Programming | 3 | 02-01-2006 20:55 |