Functionality:
When user presses the big dome push button, the state of Arduino should turn from '0'/LOW to '1'/HIGH at the serial monitor of the Arduino.
Issue:
When I trigger on the big dome push button, the state did not trigger from LOW to HIGH, it still remained LOW.
I have connected the "Push To Make" side of the connection to digital pin 2, following the connection write-up from: BIG DOME PUSH BUTTON.
However at this point, the trigger state is not working, please assist.
const int buttonPin = 2; //the number for the pushbutton pin (DIGITALPIN)
uint8_t btnCnt = 1;
bool outputState = false;
void setup() {
Serial.begin(9600);
//for Push button pin
pinMode(buttonPin, INPUT);
}
void loop() {
outputState |= digitalRead(buttonPin); // if pushButton is high, set outputState (low does nothing)
// Print the output
if (outputState) {
switch (btnCnt++) {
case 100:
--btnCnt;
outputState = false;
break;
}
Serial.println("1");
} else {
Serial.println("0");
btnCnt = 0;
}
delay(100);
}