MeEncoderOnBoard library bug


#1

Hi there,
after i spend some time thinking if i am to stupid to find the right parameters for the pulse count + gearbox ratio for my encoder motor, i found that there is a bug in the Arduino Encoder library:
The setRatio method is defined with an int parameter:
void MeEncoderOnBoard::setRatio(int16_t RatioValue);
Of course this has to be a float. otherwise you cannot set the right gearbox ratio value:
void MeEncoderOnBoard::setRatio(float RatioValue);

Files: MeEncoderOnBoard.cpp + .h

Best,
Ben


#2

Hello Ben,
Could you please tell us more details?
What is wrong when using an integer ratio value?


#3

Most Gearboxes do not have integer ratios. In my case for example i used a motor with a gearbox ratio around 4.4. This is confusing because the demo files for the onboard encoder also assigns a float value.

because the method converts this into an integer value there is no chance to setup a gearbox with non integer ratios correctly. You just have to change the definition in both files from int to float and everything works as is should be.


#4

Currently it doesn’t support float, only integar, which is not a bug.

If you have question about the library, you may upload issue in Github-issue and discuss with the author. Here is the address:


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.