const int buttonPin = 3; // the number of the pushbutton pin
const int outputPin = 4; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
Serial.begin(9600);
pinMode(outputPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
// read the state of the pushbutton value:
digitalWrite (outputPin, LOW);
buttonState = digitalRead(buttonPin);
Serial.println (buttonState);
if (buttonState == HIGH)
{
Serial.println("ON");
delay(1000);
}
if (buttonState == LOW)
{
Serial.println("OFF");
delay (1000);
}
}