//03_Test_LCD_and_LEDs
#include <LiquidCrystal_I2C.h>
#define LED_1_PIN 12
#define LED_2_PIN 13
// Initialize the LiquidCrystal_I2C lib as "lcd" and set the LCD I2C address to 0x27 and set the LCD configuration to 16 x 2.
// In general, the address of a 16x2 I2C LCD is "0x27".
// However, if the address "0x27" doesn't work, you can find out the address with "i2c_scanner". Look here : https://playground.arduino.cc/Main/I2cScanner/
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println();
delay(1000);
pinMode(LED_1_PIN, OUTPUT);
pinMode(LED_2_PIN, OUTPUT);
digitalWrite(LED_1_PIN, LOW);
digitalWrite(LED_2_PIN, HIGH);
// Initialize lcd.
lcd.init();
// Turn on the LED backlight on the LCD.
lcd.backlight();
// Clean the LCD display.
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_1_PIN, !digitalRead(LED_1_PIN));
digitalWrite(LED_2_PIN, !digitalRead(LED_2_PIN));
lcd.setCursor(0,0);
if (digitalRead(LED_1_PIN) == HIGH) lcd.print("LED 1 : ON ");
if (digitalRead(LED_1_PIN) == LOW) lcd.print("LED 1 : OFF");
lcd.setCursor(0,1);
if (digitalRead(LED_2_PIN) == HIGH) lcd.print("LED 2 : ON ");
if (digitalRead(LED_2_PIN) == LOW) lcd.print("LED 2 : OFF");
delay(2000);
}