Why is there "LOW" and false after each boolean.
const int ledPin = 12;
const int buttonPin = 2;
boolean lastButton = LOW;
boolean currentButton = LOW;
boolean ledOn = false;
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
boolean debounce(boolean last){
boolean current = digitalRead(buttonPin);
if(last != current){
delay(50);
boolean current = digitalRead(buttonPin);
}
return current;
}
void loop(){
currentButton = debounce(lastButton);
if(lastButton == LOW && currentButton == HIGH){
ledOn = !ledOn;
lastButton == HIGH;
}
lastButton = currentButton;
digitalWrite(ledPin, ledOn);
}