#include <Arduino.h>

// Initialize LED and button
const int ledPin = 3;       // LED connected to GPIO 3
const int buttonPin = 16;   // Button connected to GPIO 16

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);     // Set LED pin as output
  pinMode(buttonPin, INPUT);   // Set button pin as input
  Serial.println("LED with button");
}

void loop() {
  int buttonState = digitalRead(buttonPin);  // Read button state

  if (buttonState == HIGH) {  // Button is pressed
    digitalWrite(ledPin, HIGH);  // Turn LED ON
  } else {  // Button is not pressed
    digitalWrite(ledPin, LOW);   // Turn LED OFF
  }

  delay(100);  // Short delay to debounce the button
}
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT