Quadrature Encoder Object question...
Chris_D
Posts: 305
Hi guys,
I have a question about the quadrature encoder object I am hoping someone can answer.· I would like to know if there is a way to reset the counters to zero?· I thought I could just set the variable to zero but that didn't seem to work out very well.· Apparently the object somehow prevents this from happening.
Chris
·
I have a question about the quadrature encoder object I am hoping someone can answer.· I would like to know if there is a way to reset the counters to zero?· I thought I could just set the variable to zero but that didn't seem to work out very well.· Apparently the object somehow prevents this from happening.
Chris
·
Comments
-tellurian
Thanks guys!
Chris
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
Thanks very much for the link - I have downloaded your code and will certainly incorporate this feature!!!
Chris
You should not need to reset the counter, and in fact if one were to achive resetting it outside the·cog that is reading the encoder(s), you'd be possibly creating a slight error (if the counter changed at a critical time in the read/write sequence of the encoder cog).
For this reason, the Quadrature Encoder cog does not allow resetting the counter and, instead, provides a much more useful feature... Delta tracking.
Simply call ReadDelta() every time you want to know how much the encoder has moved since the last time you "looked"... it provides a signed value, so if it moved backwards, you'd get a negative number.· If it hasn't moved since the last time you called ReadDelta(), then it returns 0.
Read item 4 of "To use this object:" at the bottom of the code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Jeff Martin
· Sr. Software Engineer
· Parallax, Inc.