//I2C接口LCD1602的模块资料链接:https://wiki.dfrobot.com.cn/_SKU_DFR0063_IIC_LCD1602_display_module_%E5%85%BC%E5%AE%B9Gadgeteer
//I2C接口LCD1602的模块仿真资料链接:https://docs.wokwi.com/parts/wokwi-lcd1602
//代码用于Firebeetle ESP32开发板时,LCD连接电源到VCC,GND,SDA和SCL,
//3.3V电源供电电压低于5V,不能满足该模块的需要,而VCC是5V电压,可以驱动该LCD模块
#include <Wire.h> //该头文件wokwi仿真时必不可少,否则编译不通过,但Arduino IDE编译时可以不写
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x20,16,2);
// LCD1602 custom characters example
uint8_t heart[8] = {
0b00000,
0b01010,
0b11111,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000,
};
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Hello");
lcd.setCursor(6,0);
lcd.print("Student");
Serial.begin(9600);
Serial.println("Enter Your Input Here: ");
lcd.createChar(3, heart);
lcd.begin(16, 2);
lcd.print(" I \x03 Arduino");
}
void loop() { }