Hi everyone, I am currently doing a project which need to calculate the distance traveled. We plan to use
simple optical encoder with light sources and light detector(see on attachment). May I know where can I find the arduino code for this ?
What is the maximum number of pulses per second ?
If it is slow you could probably detect the pulses with a simple digitalRead()
If it is too fast for that you would need tp set up an Interrupt Service Routine (ISR) - see Nick Gammon's tutorial.
...R
I bought one of those smartcar chassis a while back and mine came with encoder wheels and the IR emitter/receiver parts to go with them but I never ended up trying to use them as I was just building a basic obstacle avoidance bot.
At any rate, i think you might find the following page both useful and informative, I like it better than the "Rotary encoder" page here because it's actually readable. Check this out and let me know if you have any questions. Using optical position rotary encoders