Thread: Using Encoders
View Single Post
  #3   Spotlight this post!  
Unread 14-01-2010, 16:43
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Using Encoders

Check out the Encoder class and associated documentation. You connect the A and B channels to digital inputs and supply the port numbers to the Encoder constructor. From there you can read the counts or rate.

You can also connect it to a PID object to control direction. For driving straight you can use something like the right-left encoder value. As one side gets ahead the value will swing either positive or negative and the PID class can apply the necessary correction to the turn rate.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote