View Full Version : Should I use a Pot or an encoder, and how?
mallot1243
16-11-2005, 21:48
I'm having a problem, I'm trying to figure how I would count the revolutions of the driveshaft in autonomous so I can create a simple distance = (2 * revolutions * 3.14159) equation. However, with the refresh rate I don't think I could correctly count revolutions without errors.
sanddrag
16-11-2005, 21:52
What you really should use is called a quadrature encoder and you can find some sample code for it on www.kevin.org/frc
Also, I think you need wheel radius in that equation. :)
bear24rw
17-11-2005, 22:31
However, with the refresh rate I don't think I could correctly count revolutions without errors.
I think that you need to use interups... that way the refresh rate of your user_routines wont matter...
Rickertsen2
18-11-2005, 00:39
You need to use encoders. Pots can only rotate a certian number of degrees before hitting their physical limits. If you search encoders on these forums you should find alot of good info.
sciguy125
18-11-2005, 02:25
I think that you need to use interups... that way the refresh rate of your user_routines wont matter...
An alternate method would be to use a hardware counter. Have the counter count the encoder ticks, then read them whenever you're ready. That way, timing doesn't matter at all. Well, I guess if you're trying to figure out speed you'd need to know the amount of time between reads...
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.