/*
* 1602 LCD Sample with LiquidCrystal_I2
* https://github.com/agnunez/ESP8266-I2C-LCD1602
*
* PCF8574-----1602LCD-----WeMos
*
A0
-----GND
*
A1
-----GND
*
A2
-----GND
*
VSS
-----GND
* P0 ----- RS
* P1 ----- RW
* P2 ----- EN
* P3 ----- B/L
* P4 ----- D4
* P5 ----- D5
* P6 ----- D6
* P7 ----- D7
*
VDD
-----5V
*
*
SDA
-----D3(GPIO_0)
*
SCL
-----D4(GPIO_2)
*
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x20 for a 16 chars and 2 line
display
LiquidCrystal_I2C lcd(0x20, 16, 2);
void setup()
{
lcd.begin(D3, D4); // sda=GPIO_0, scl=GPIO_2
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop()
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting
begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis() / 1000);
}
|