const int buttonPin=4;//the number of the pushbutton
const int ledPin=5;
//variable for storing the pushbutton status
int buttonState=0;
void setup(){
Serial.begin(115200);
//initialize the pushbutton pin as input
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop(){
buttonState=digitalRead(buttonPin);
Serial.println(buttonState);
if(buttonState==HIGH){
//turn on LED
digitalWrite(ledPin, HIGH);
}else{
//turn off led
digitalWrite(led, LOW);
}
}