Go to Post I am just very happy that I have never been responsible for the spelling of Karthik's last name on a name tag. Seriously. - JaneYoung [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
  #2   Spotlight this post!  
Unread 26-01-2017, 04:49
Auxiliatrix Auxiliatrix is offline
Registered User
FRC #0604
 
Join Date: Jan 2017
Location: San Jose, California
Posts: 2
Auxiliatrix is an unknown quantity at this point
Re: Cannot program two ultrasonic sensors. Please help us!

Hi, I'm programming something similar for our team's robot. For your code, I'm not sure if this was intentional or not, but in the Ultrasonic2 class default constructor, you don't seem to turn on automatic mode? However, I don't think that should be an issue.

Here are some possible ideas:

Automatic mode means that the sensor is continuously reading, correct? It's possible that having two ultrasonic sensors would cause interference with each other, if that's what's causing the error. If this were the issue, you should try implementing them without automatic mode (getting them to ping only when prompted).

However, if you cannot find a solution to this specific code, might I suggest implementing your sensors as analog inputs? The Ultrasonic class is, after all, an extension of the AnalogInput class, and what our team has been doing is treating the sensors as basic analog inputs, taking the readings, and then multiplying the number by some constant to retrieve the data in inches.
In this case, the implementation would be nearly identical to that of encoders, in terms of reading data and putting it onto the dashboard.

I hope some of this helps.
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


All times are GMT -5. The time now is 09:53.

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