I am trying to create a program that will turn on and off a process every time a button is pressed. I am testing that part of the program by first creating this program. As it is the readout on my Serial.Print continues to display 0, even after the button is pressed. I have added an LED to make sure the button is being pressed.
int buttonPin = 10;
boolean value = false;
void setup(){
pinMode(buttonPin, INPUT);
Serial.begin (9600);
}
void loop(){
if (digitalRead(buttonPin) == HIGH) {
value=!value;
}
Serial.println(value);
delay(10);
}
Any help, please.