// Start here //////////////////
//Simple SW0 control LED0
//SW0 press => LED0 ON
//SW0 unpress => LED0 OFF
int LED0 = 0;
int SW0 = 15;
bool flag_SW0;
//SW0 press => 0
//SW0 unpress => 1
void setup() {
Serial1.begin(115200);
Serial1.println("Hello, Raspberry Pi Pico W!");
pinMode(LED0, OUTPUT);
pinMode(SW0, INPUT_PULLUP);
}
void loop() {
flag_SW0 = digitalRead(SW0);
if(flag_SW0){
digitalWrite(LED0, LOW);
}
else{
digitalWrite(LED0, HIGH);
}
} ////////////////////////////