Codice Arduino+LCD+LCD Shield

#include <LiquidCrystal.h>

LiquidCrystal lcd(8,9,4,5,6,7);

const int MAX_LENGTH = 16;
char buf[MAX_LENGTH];
String str;

void setup() {
Serial.begin(9600);

lcd.begin(16, 2);
lcd.print("IIS CALVINO - GE");
}

void clearLCD(){
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
str=Serial.readString();
}
void loop() {

if(Serial.available()){
clearLCD();
str.toCharArray(buf, str.length()-1);
lcd.write(buf);
}
}

Ultime modifiche: mercoledì, 17 novembre 2021, 10:45