diff --git a/src/tinyLCD_I2C/tinyLCD_I2C.cpp b/src/tinyLCD_I2C/tinyLCD_I2C.cpp index f9b2584..110740c 100644 --- a/src/tinyLCD_I2C/tinyLCD_I2C.cpp +++ b/src/tinyLCD_I2C/tinyLCD_I2C.cpp @@ -173,12 +173,16 @@ inline size_t tinyLCD_I2C::write(uint8_t value) { // write either command or data void tinyLCD_I2C::send(uint8_t value, uint8_t mode) { - Wire.beginTransmission(_Addr); - if ( mode == 0 ) { - Wire.write(mode); - } - Wire.write((int)(value)); - Wire.endTransmission(); + int ret = 0; + uint8_t repeat = 4; + do { + Wire.beginTransmission(_Addr); + if ( mode == 0 ) { + Wire.write(mode); + } + Wire.write((int)(value)); + ret = Wire.endTransmission(); + } while (ret && repeat--); }