View Single Post
  #4   Spotlight this post!  
Unread 25-01-2015, 20:36
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 222
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: How send ultrasonic sensor data to driver station?

Quote:
Originally Posted by TimTheGreat View Post
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
So both of those lines you would put in the RIO's code? Do I have to import anything else other than wpilib? Thanks for the detailed response!