I need to log the number of pulses from a rotary encoder. The encoder is attached to a shaft that may turn a small increment about every second. The shaft will rotate, hold, then rotate again -- repeatedly throughout the day. I'm not concerned with encoder direction as it moves only one way.
I can NOT log any zero values and need to log the count from the group of pulses between the shaft pause interval. Boiled down I need to log how far the shaft turns each time it rotates. I'm not sure about how to go about this. Any ideas?
Arduino and Rotary Encoder w/ GPS Project
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Arduino and Rotary Encoder w/ GPS Project
This should get you started http://playground.arduino.cc/Main/RotaryEncoders
- dpaulc
- Posts: 34
- Joined: Thu May 09, 2013 11:40 am
Re: Arduino and Rotary Encoder w/ GPS Project
I have created a pulse counter that works fine. It's that I have to count pulses in groups at irregular intervals that's giving me troubles. Is this a job for interrupts?
Here's the logic:
Wait for pulses.
When pulses start, count them.
When pulses stop, total them and log this value (along with GPS position),
Repeat
Here's the logic:
Wait for pulses.
When pulses start, count them.
When pulses stop, total them and log this value (along with GPS position),
Repeat
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Arduino and Rotary Encoder w/ GPS Project
Post your code, perhaps we can give you some pointers.
Please be positive and constructive with your questions and comments.