效果视频请见做了三天的arduino(Mega2560+hc-08+ lcd160)_哔哩哔哩_bilibili
#include <LiquidCrystal.h> //引入依赖
const int rs = A3, en = A2, d4 = 7, d5 = 6, d6 = 5, d7 = 4; //初始化针脚
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int R = 10, G = 9, B = 8;
int a = 0;
String readString;
String readString1 = "";
//String readString2;
void setup() {
Serial.begin(9600);
Serial3.begin(9600); //定义波特率
lcd.begin(16, 2); //设置LCD要显示的列数、行数,即2行16列
pinMode(53, INPUT);
pinMode(11, INPUT);
pinMode(3, INPUT);
} //打印从重置后的秒数
void loop() {