const int numLED = 4;
const int GPIO_Pins[] = {2, 3, 4, 5};
void setup()
{
Serial1.println("Hello Raspberry Pi Pico");
for(int led=0;led<numLED;led++)
{
pinMode(GPIO_Pins[led],OUTPUT);
}
}
void main()
{
if(Serial1.available()>0)
{
int userInput = Serial1.parseInt();
if(userInput>=1 && userInput<=4)
{
for(int led=0;led<numLED;led++)
{
digitalWrite(GPIO_Pins[led], LOW);
}
digitalWrite(GPIO_Pins[userInput-1]);
}
}
}