// LCD1602 to Arduino Uno connection example
#include <LiquidCrystal_I2C.h> // if you don´t have I2C version of the display, use LiquidCrystal.h library instead
//LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
//LiquidCrystal_I2C lcd(0x3f,16,2); // set the LCD address to 0x3f for a 16 chars and 2 line display
// if you don´t know the I2C address of the display, use I2C scanner first (https://playground.arduino.cc/Main/I2cScanner/)
LiquidCrystal_I2C lcd(0x27,16,1); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup() {
lcd.init();
lcd.backlight(); // Turn on the backlight
}
void loop() {
printCentered("L\xC3\xA5t Petter bygga \xC3\xA5t dig text");
delay(1000);
lcd.clear();
delay(500);
}
void printCentered(String text) {
//int textLength = text.length();
//int spaces = (16 - textLength) / 2;
//lcd.setCursor(spaces, 0);
lcd.print(text);
}