// set pin numbers
const int buttonPin = 32; // the number of the pushbutton pin
const int ledpin = 25; // the number of the LED pin
// variable for storing the pushbutton status
int buttonState = 0;
void setup() {
Serial.begin(115200);
pinMode(buttonPin, INPUT);
// initialize the LED pin as an output
pinMode(ledpin, OUTPUT);
}
void loop() {
// read the state of the pushbutton value
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH
if (buttonState == HIGH) {
digitalWrite(ledpin, HIGH);
Serial.println("Button Pressed");
} else {
digitalWrite(ledpin, LOW);
Serial.println("Button Unpressed");
}
}