One of my worries is that im using most of the timers on the Arduino for PWM to control motors, and im assuming with quadrature encoders you would need two timers per encoder to keep track of both channels?
If you want to use them to keep track of distance traveled and compare average speed of each motor wouldnt you need to keep a running average of the pulses? Not just check an interrupt every once and a while?
So if one needed to count every pulse of an encoder using an interrupt you would set up an interrupt handler to increment you variable every time pin X goes hi. Now wont this cause the mcu to stop everything to increment the variable? at 141 pulses per revalution x 2 channels x 2 motors thats, alot of interuption to the main program wont that kill everything else you have going on?
Ive obviously got the wrong idea about something here.. This is how im thinking about EncodersIn order to keep track of pulses you need to count them obviously so for every hi pulse you would increment a variable. You would need to monitor two channels for each encoder, so overall to read a quad encoder you need two pins and two variables. This is just a simplification of things, ignoring overflow.
Awesome thank you very much, do you happen to have any code using PID that keeps the wheels the same speed?
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16