View Single Post
  #4   Spotlight this post!  
Unread 30-01-2016, 12:26
jajabinx124's Avatar
jajabinx124 jajabinx124 is offline
Team 2052 Alumnus
AKA: Kshitij Wavre
no team
Team Role: College Student
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Madison, WI
Posts: 541
jajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond reputejajabinx124 has a reputation beyond repute
Re: Maxbotix not working well with RoboRIO?

Quote:
Originally Posted by team-4480 View Post
The code is as simple as it comes:

Code:
#in init code
ultrasonic = wpilib.analog.input(3)
#in teleop
print(ultrasonic.getValue())
I see on the datasheet that it is supposed to be able to output 0 to 1023 for analog, but since I get nothing close to that, does that mean my sensor has gone bad or something? Thanks!
Possibly. Try using ultrasonic.getVoltage() instead of getValue() and see what you find- this method returns the analog value in calibrated units. (maybe this is what the data sheet is referring to when it says analog voltage bits values should be in between 0-1023)
__________________
FRC Volunteer CSA (MRI off-season event, 2017 Lake Superior Regional, 2017 10,000 Lakes Regional) 2016 - Present
FRC 2052 KnightKrawler (Team Captain, Strategist, Scouting, Programming) 2013 - 2016

1 Division Win & Einstein Appearance
3 Division Quarter-Finalists
1 Regional Chairman's Award
5 Regional Wins, 3 Regional Finalists
3 MN State Championship Wins, 1 MN State Championship Finalist
Thanks to all our alliance partners who krawled with us: 41, 70, 225, 525, 1595, 2054, 2062, 2122, 2175, 2227, 2472, 2526, 2883, 2990, 3018, 3244, 3276, 3310, 3313, 3360, 3538, 3692, 4011, 4198, 4536, 4607, 4778, 5172, 5690