Quad encoder readout, display of the position on LCD, reading back last encoder positions from LCD or EEPROM.
The Arduino should keeping track of an encoder position for extended periods of time. Unfortunately, any reset will clear the memory and stored encoder positions are lost. A software disconnect / reconnect will reset the Arduino, hence it is necessary to store the encoder position in some external memory. The internal EEPROM is not suited for continuous tracking of the position due to its limited number of writes.
The example program uses an HD44780 LCD display to show the current encoder position and will read back the last position from the LCD upon reset. After some minutes of inactivity, the encoder position is saved to EEPROM, for a more reliable recovery.
The sketch requires the "EEPROM_anything.h" code and a modified LCD library "LiquidCrystal_rw" including read functions. All files are included in the zip file.
Have fun,
Thomas
Read_Quad_Encoder.zip (12.3 KB)