View Single Post
  #7   Spotlight this post!  
Unread 09-14-2016, 02:51 PM
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,720
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Encoder Question / Recomendation

Quote:
Originally Posted by RacerX View Post
Would a potentiometer have the same programming as the encoder? Would it always know where say zero degrees is and where 90 degrees is, and everything in between? Or, would we have to set zero each time?
programming is different. A potentiometer is an analog device. As you rotate the shaft, the voltage of the output changes incrementally. WPILib actually has a rather nice class (AnalogPotentiometer) that can be used for this - when you create the instance, you can specify the range of the potentiometer (They're sold as 270 degree, 360 degree, 3600 degree, etc) and an offset for where you want 0 to be. That way when reading values you'll get them right in degrees, positive or negative.

Oh, and another benefit to potentiometers... being analog devices, they're really easy to verify functionality with a multimeter!
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote