#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C 주소 확인 후 변경
void setup() {
Serial.begin(9600);
Wire.begin();
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Ready!");
}
void loop() {
static String text = ""; // 입력 문자열 저장용
while (Serial.available()) {
char c = Serial.read();
if (c == '\n') { // 엔터 입력 시 LCD에 표시
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(text);
text = ""; // 문자열 초기화
} else {
text += c;
}
}
}