void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(2, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
if (Serial.available()) {
String inputword = Serial.readStringUntil('\n');
if (inputword == "ON") {
digitalWrite(2, HIGH);
Serial.println("點亮內建 Led燈");
} else if (inputword == "OFF") {
digitalWrite(2, LOW);
Serial.println("關閉內建 Led燈");
}
}
}