![]() |
How do Ultrasonic sensors work? Java
What value is the Ultrasonic sensor looking for? Generally Analog or Digital Inputs/Outputs are looking for a channel integer but the Ultrasonic sensor requires two integers a pingChannel and an echoChannel, where do I find these values?
|
Re: How do Ultrasonic sensors work? Java
I'm assuming you're using something like the vex ultrasonic sensor (otherwise you should be able to treat an ultrasonic like any other sensor).
In this case, I believe that the pingChannel is the PWM out pin that goes into the input wire and the echoChannel is the analog channel you read the final value on. |
Re: How do Ultrasonic sensors work? Java
Quote:
|
Re: How do Ultrasonic sensors work? Java
We have an Arduino ultrasonic sensor.
http://www.radioshack.com/radioshack...l#.VLWn7SvF-oE It doesn't have an input and an output is there a way we can still use it? |
Re: How do Ultrasonic sensors work? Java
So there are several types of ultrasonic rangefinders (at least electrical output-wise). There are digital sensors with an output pin (echo channel) and input pin (ping channel). With this type you trigger the input pin and the output pin will respond with a pulse whose duration is proportional to the measured distance (this is the kind of sensor the Ultrasonic class in the WPILib is mainly concerned with). There are also analog sensors which constantly stream distance through a scaled voltage signal from an analog pin. The kind you have is yet another type: a digital sensor that uses the SIG pin as both an input and output pin. You have to trigger the pin, and then the same pin will respond with a pulse whose duration is proportional to the measured distance.
Implementing this code-wise: you may get away with using the same channel for the echo and ping pins in the constructor for the Ultrasonic object (or this might throw an error, never tried it before). I don't have experience with this type of sensor, but that would be my first bet. Electrically, just plug it into a DIO port. This is the sample source code referenced in that sensor's user guide: Code:
|
| All times are GMT -5. The time now is 02:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi