View Single Post
  #3   Spotlight this post!  
Unread 25-01-2015, 20:32
TimTheGreat's Avatar
TimTheGreat TimTheGreat is online now
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 236
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: How send ultrasonic sensor data to driver station?

So there is a special kind of Driver Station called SmartDashboard. It is basically an 'application' that you can add (basically) anything to, including Ultrasonic values. To do this, create an analog input object (we'll call this ultrasonic).
Code:
self.ultrasonic = wpilib.AnalogInput(PortNumber)
Now, we must add it to SmartDashboard.
Code:
wpilib.SmartDashboard.putNumber('Ultrasonic', self.ultrasonic.getVoltage())
The reason it is getVoltage() is because thats how the ultrasonic returns its values, so it'd be best to set up a test board, then hold something in front of it at measured distances, record these values, then use them in your code.

For more SmartDashboard help check out http://robotpy.readthedocs.org/en/la...Dashboard.html
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP