All of the LED action takes place in the last few lines of the program.Code: [Select]if (buttonPushCounter % 4 == 0)Until the first button press, buttonPushCounter = 0. 0 % 4 = 0 so the LED is HIGH. Unless the buttonPushCounter is greater than 0 do not turn the LED on.Code: [Select]if (buttonPushCounter % 4 == 0 && buttonPushCounter > 0) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); }
if (buttonPushCounter % 4 == 0)
if (buttonPushCounter % 4 == 0 && buttonPushCounter > 0) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); }
*I find Eagle and KiCad too complex for the simple boards that I make.
Code: [Select]buttonState = digitalRead(buttonPin); In the 21st century, "buttonState" doesn't have global scope (it wouldn't be a Boolean either)
buttonState = digitalRead(buttonPin);
bool buttonState = digitalRead(buttonPin) == HIGH;
_5volts _0volts