Log in

View Full Version : Single Channel Encoder


Bpk9p4
21-02-2016, 17:48
i was wondering if anyone has an example how to code a single channel encoder. This is for are shooter wheel so we do not need direction and we would like to save the DIO for other sensors

Alan Anderson
22-02-2016, 00:22
For our purposes, "encoder" almost always means "quadrature encoder" which requires two channels. For a single channel digital sensor, open it as a simple counter.

Bpk9p4
22-02-2016, 00:54
so how would i go about finding the speed then?

Alan Anderson
22-02-2016, 01:10
Compute the speed as the number of counts divided by the amount of time. You can read both the current count and the current time. Do that periodically, subtract the previous values from the new values, and divide the differences to yield a rate of counts per time.