void setup() {
// the "input pullup" configuration is a technique used to enable
//the internal pull-up resistor on a digital input pin.
//This internal pull-up resistor is a feature of many microcontrollers,
//When you enable the internal pull-up resistor on a digital input pin,
//it helps ensure a stable and defined logic level
//when the pin is not actively being driven to a HIGH or LOW state externally
pinMode(2, INPUT_PULLUP);
}
void loop() {
int buttonState = digitalRead(2); // Read digital pin 2
if (buttonState == HIGH) {
digitalWrite(13, HIGH); // Turn on LED on digital pin 13
} else {
digitalWrite(13, LOW); // Turn off LED on digital pin 13
}
}