Arduino显示屏LCD1602自定义输入
#include<LiquidCrystal.h>
const int rs=3,en=5,d4=10,d5=11,d6=12,d7=13;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available())
{
delay(100);
lcd.clear();
}
while(Serial.available()>0)
{
lcd.write(Serial.read());
}
lcd.setCursor(0,1);
lcd.print(millis()/1000);
}
上传成功后,打开串口显示器,输入你想要输入的内容,发送成功后即可在
lcd屏上显示。