WeMOS: D1 R1 mini LCD I2C Contoh Lagi

From OnnoWiki
Jump to navigation Jump to search

Sumber: https://microdigisoft.com/how-to-use-i2c-lcd-with-esp8266-wemos-d1-mini/

Download


/*
 I2C LCD	ESP8266-Wenos D1 Mini
 GND	        GND
 VCC	        VIN
 SDA	        D2
 SCL	        D1
*/
#include < LiquidCrystal_I2C.h >

// set the LCD number of columns and rows
int lcdColumns = 16;
int lcdRows = 2;

// set LCD address, number of columns and rows
// if you don't know your display address, run an I2C scanner sketch
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);  

void setup(){
  lcd.begin(5, 4);// initialize LCD
  lcd.init();
  // turn on LCD backlight                      
  lcd.backlight();
}

void loop(){
  // set cursor to first column, first row
  lcd.setCursor(0, 0);
  // print message
  lcd.print("Welcome");
  //delay(1000);
  // clears the display to print new message
  //lcd.clear();
  // set cursor to first column, second row
  lcd.setCursor(0,1);
  lcd.print("Hello World!");
  delay(1000);
  lcd.clear(); 
}


Referensi