Reads counts from the encoders on the Romi 32U4.
This class allows you to read counts from the encoders on the Romi 32U4, which lets you tell how much each motor has turned and in what direction.
The encoders are monitored in the background using interrupts, so your code can perform other tasks without missing encoder counts.
To read the left encoder, this class uses an interrupt service routine (ISR) for PCINT0_vect, so there will be a compile-time conflict with any other code that defines a pin-change ISR.
To read the right encoder, this class calls attachInterrupt(), so there will be a compile-time conflict with any other code that defines an ISR for an external interrupt directly instead of using attachInterrupt().
The standard Romi motors have a gear ratio of 3952:33 (approximately 120:1). The standard Romi encoders give 12 counts per revolution. Therefore, one revolution of a Romi wheel corresponds to 12*3952/33 (approximately 1437.09) encoder counts as returned by this library.
Definition at line 31 of file Romi32U4Encoders.h.
This function returns true if an error was detected on the left-side encoder. It resets the error flag automatically, so it will only return true if an error was detected since the last time checkErrorLeft() was called.
If an error happens, it means that both of the encoder outputs changed at the same time from the perspective of the ISR, so the ISR was unable to tell what direction the motor was moving, and the encoder count could be inaccurate. The most likely cause for an error is that the interrupt service routine for the encoders could not be started soon enough. If you get encoder errors, make sure you are not disabling interrupts for extended periods of time in your code.
Definition at line 133 of file Romi32U4Encoders.cpp.