|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Parallax Java Implementation?
Hi everyone. Our team (Team 1884) has been trying to use ultrasonics for this year's game. We've been successful in using an analog sensor but are facing trouble in reading from the Parallax digital ultrasonic sensors. Since the Ultrasonic Java class should work with our Parallax model (according to the documentation), we decided to use it.
Below is our code (parallax is an Ultrasonic object that has been properly constructed, enabled, and initialized in the code): Code:
public double parallaxValue()
{
parallax.ping();
Timer.delay(0.05);
double parallaxReading = parallax.getRangeInches();
System.out.println("Parallax: " + parallaxReading + " inches");
return parallaxReading;
}
Unfortunately, this is always returning 0.04068 inches, regardless of which way the sensor points. We tried the getRangeMM() method but that just returned a constant of 1.033272 mm, which is just 25.4 mm/in * 0.04068 inches. We also tried changing the Timer delay, but to no avail. We don't see why this is happening since the ultrasonic just takes the amount of time it takes for a pulse to return, multiplies it by the speed of sound (in inches/sec), and divides that distance by two. We'd really appreciate some input on why we always get this value. Has anyone else also tried the Parallax ultrasonic and gotten it to work? Thank you, Team 1884 |
|
#2
|
|||
|
|||
|
Re: Parallax Java Implementation?
Sorry to double post, but has any team successfully used a Parallax sensor before? If so, how do they work (and would they work with the code I posted above)?
We'd really appreciate some help with this! Thanks, bhasinl Team 1884 |
|
#3
|
|||
|
|||
|
Re: Parallax Java Implementation?
Are you talking about the Parallax "Ping" sensor? I believe that it only has a single I/O line and is not supported. The maxbotics sensors that return analog values work very well, also the Vex/Davantech sensors work. The Vex and Daventech SRF04 sensors have have two lines, one to do the ping and another to read the return timing.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New Seeding Algorithm Implementation | DanDon | Rules/Strategy | 9 | 12-01-2010 00:07 |
| **FIRST EMAIL**/Java and Orbit Balls *****JAVA DISCUSSION*** | Pjohn1959 | Programming | 37 | 31-08-2009 15:55 |
| limit switch implementation | Integral | NI LabVIEW | 0 | 10-02-2009 19:21 |
| Implementation of Traction Control | keehun | Programming | 5 | 10-02-2009 10:02 |
| Gyro Implementation | Guarana | Programming | 12 | 07-02-2008 17:07 |