/*
Blink LED with UART
Turns an LED on for one second, then off for one second, repeatedly.
*/
#define YELLOW_LED 12
int incomingByte;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
pinMode(3, OUTPUT);
pinMode(YELLOW_LED, OUTPUT);
// https://docs.wokwi.com/guides/serial-monitor
Serial1.begin(115200);
delay(100);
Serial1.println("Press ENTER to start!\n");
while(!Serial1.available() > 0);
incomingByte = Serial1.read();
if(incomingByte == '\n')
Serial1.println("Blink onboard LED every second!");
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(3, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(YELLOW_LED, HIGH); // turn the LED on (HIGH is the voltage level)
Serial1.print("Onboard LED is ON!\n");
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
digitalWrite(3, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(YELLOW_LED, LOW); // turn the LED on (HIGH is the voltage level)
Serial1.print("Onboard LED is OFF!\n");
delay(1000); // wait for a second
}