diff --git a/examples/AutoFindAddress/AutoFindAddress.ino b/examples/AutoFindAddress/AutoFindAddress.ino new file mode 100644 index 0000000..7c72d8d --- /dev/null +++ b/examples/AutoFindAddress/AutoFindAddress.ino @@ -0,0 +1,28 @@ +#include +#include + +// Auto detect LCD address between 0x3F or 0x27 +byte autolcdaddr(){ +Wire.begin(); +Wire.beginTransmission(0x27); +return Wire.endTransmission()? 0x3F:0x27; +} + + +// Set the LCD for a 16 chars and 2 line display +LiquidCrystal_I2C lcd(autolcdaddr(), 16, 2); + +void setup() +{ + // initialize the LCD + lcd.begin(); + + // Turn on the blacklight and print a message. + lcd.backlight(); + lcd.print("Hello, world!"); +} + +void loop() +{ + // Do nothing here... +}