// constants won't change. They're used here to
// set pin numbers:
int buttonPin = 23; // the number of the pushbutton pin
int ledPin = 8; // the number of the LED pin
int buttonState; // the current reading from the input pin
int lastButtonState = LOW; // the previous reading from the input pin
int reading = 1;
void setup() {
// Set initial pin states, and turn off the LED
pinMode(buttonPin, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
}
void loop() {
// Read the state of the switch into a local variable.
int reading = digitalRead(buttonPin);
// if the button state has changed:
if (reading == 0)
{
digitalWrite(ledPin, HIGH);
}
// if the button state has changed:
else if (reading == 1)
{
digitalWrite(ledPin, LOW);
}
//Serial.println(reading);
//Serial.println(reading);
//delay(1000);
}