Closed bymaximus closed 9 years ago
Hi, the behavior you described is correct and it works back and forward the right way. There will always be a point in the position range where the sign flips around. One is at 0 to -1 and the other is 8191 to -8192. This is because the _position variable uses 16 bit int and has to count the internal positions. There are 4 different positions before one turn is detected from the external point of view.
You can use 32 bit for the position counters:
The the position will flip from 536870911 to -536870912. Enough ? Should I check this in ? It will require more programming space.
Thanks for reply. 536870911 sure is enough. I need a bigger value than 8191 for my current project, I will change the code.
Thank you again.
Hi, first of all thanks for this library.
I got some strange behavior here. When position getting in 8191 to 8192 it get -8192.
Try setPosition(8190) and then rotate.