int led1=2;
int pb=7;
void setup()
{
// put your setup code here, to run once:
Serial.begin(96000);
pinMode(led1, OUTPUT);
pinMode(pb, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
int buttonState = digitalRead(pb);
if (buttonState == LOW){
Serial.println("The button is pressed");
digitalWrite(led1, HIGH);
}
else
if (buttonState == HIGH){
Serial.println("The button is unpressed");
digitalWrite(led1, LOW);
}
}