// ButtonPin5.ino // // Gerard Paresys // 4 9 2023 // // Pushbutton from Pin 5 to ground // Arduino Card with Led on Pin 13 // // OK Adafruit Feather M0 Radio // const int buttonPin = 5; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin int buttonState = 0; // variable for reading the pushbutton status void setup() { pinMode(ledPin, OUTPUT); // initialize the LED pin as an output pinMode(buttonPin, INPUT_PULLUP); // initialize the pushbutton pin as an input } void loop() { buttonState = digitalRead(buttonPin); // read the state of the pushbutton if (buttonState == LOW) { // Pushbutton pressed. digitalWrite(ledPin, HIGH); // LED on: } else { // Push button released. digitalWrite(ledPin, LOW); // LED off: } }