More I2C on ESP32 DO-IT DevKit1. 2X16 LCD Control
Now, since the first I2C programming on ESP32 was done successfully, I decided to add more items to see what I can do with my ESP32 DevKit.
Set-up your cable connections as following fritzing connection image.
* Again, I can't find my ESP32 Do-it DevKit and GY-88 Fritzing parts, so I have used similar ones to draw. Now, I found I2C LCD fritzing part at least.
Before any further work, make sure perform test for response from I2C Hardware using I2C Scanning Code from previous post. Following image is the result. One additional address is found.
I have attached the LCD I2C Serial Display Library that I found on web. LiquidCrystal_I2C-master.zip
You must setup the library into your ~/Arduino/library folder first to run this code. This code will print what you have entered from Arduino IDE's serial monitor window to the second line on LCD screen.
Code :
/*
* Displays text sent over the serial port (e.g. from the Serial Monitor) on
* an attached LCD.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
Serial.begin(115200);
// clear the screen
lcd.clear();
lcd.print("ESP32 LCD");
lcd.setCursor(0,1);
lcd.print("by ZAKU");
}
void loop()
{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
lcd.setCursor(0,1);
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}
'ESP32 Dev. Board (English)' 카테고리의 다른 글
I2C Test with my ESP32 Do-IT DevKit using Arduino IDE (1) | 2017.12.04 |
---|