/**
* The method of searching for the LCD address on the I2C bus
*/
bool scanI2CBus() {
byte adress = EEPROM.read(LCD_I2C_ADDR);
if (adress < 10 || adress > 127) {
byte nDevices = 0;
for (byte address = 10; address <= 127; address++) {
Wire.beginTransmission(address);
byte error = Wire.endTransmission();
if (error == 0) {
adress = address;
nDevices++;
}
}
if (nDevices == 0) {
return false;
} else if (nDevices > 1) {
return false;
}
EEPROM.write(LCD_I2C_ADDR, adress);
}
lcd = LiquidCrystal_I2C(adress, 20, 4);
lcd.init();
lcd.backlight();
lcd.print(F("Aquarium Controller! ver. 1.3.7-0.5i"));
return true;
}