Go to Post When I first read this comic, I thought "Awww, how cute!". But then, thoughts of Karthik singing J. Lo's "Love Don't Cost a Thing" started running around through my head, and everything changed. - Travis Hoffman [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 13-02-2010, 08:41
bhasinl bhasinl is offline
Registered User
FRC #1884 (Griffins)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2008
Location: London
Posts: 6
bhasinl is an unknown quantity at this point
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
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 10:46.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi