|
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
|