const int Leds[] = {8,6,4,2};
const int LED = 4;
void setup() {
// put your setup code here, to run once:
Serial1.begin(9600);
Serial1.println("Hello, Raspberry Pi Pico!");
for (int i = 0; i < LED; i++) {
pinMode(Leds[i], OUTPUT);
}
}
void loop() {
if (Serial1.available() > 0) {
int userInput = Serial1.parseInt();
if (userInput >= 1 && userInput <= LED) {
for (int i = 0; i < LED; i++) {
digitalWrite(Leds[i], LOW);
}
digitalWrite(Leds[userInput - 1], HIGH);
Serial1.print(userInput);
Serial1.println("ON");
}
}
}