-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to setup range up/down for each encoder #118
Comments
or how to write function if direction of rotate was for left or right side? (up/down) like:
DIR - direction |
There is not API for this, but you can try to modify the values here: https://github.com/madhephaestus/ESP32Encoder/blob/master/src/ESP32Encoder.cpp#L185 If modifying those values is working for you, you could add class variables for those values with the _INT16_MAX and _INT16_MIN as the defaults, and an API to set them before attach() is called. I would be happy to accept a PR addin that functionality once you have tested it working for your use case. |
But it is for all connected encoders, not for each encoder, right? I need separate range for 2 encoders, for example: one for 0-120, second for 0-10 |
that's why i said "class variable" not "static variable" ;) If you made it a static variable it would be for all encoders, class variables are templated into each instance of an object. |
OK. How about https://github.com/madhephaestus/ESP32Encoder/blob/master/src/ESP32Encoder.cpp#L182 where: there is no possibly to use it as detect if encoder has CW or CCW step? |
checking for up or down count should be done by seeing if the count increased or decreased in user space and not something the encoder object should be doing since up or down is determined best by the difference between the current count, and a previous count in the arbitrary past. this should be done in user code imho. |
Maybe it will help :)
|
Hello. How to add up and down range for each encoder? Like moving between 0 to 10 or different value? ESP32,
For example. Range between 0 and 3 (4 positions 0;1;2;3)
encoder go to 4 and then stop. Not 3 and when moving up for 4 - is paused.
I cant find easy solution in .cpp or .h for this.
Thanks for help
The text was updated successfully, but these errors were encountered: