When I push a button on Arduino it sends a message via Serial.println.
This is displayed in the serial monitor and repeats as per my delay. Is there a method of sending this message WHEN the button is pushed instead of constantly?
Here's what I'm currently using:
if (digitalRead(switchPin3) == HIGH) {
Serial.println("3High\n\r");}
Is there a method of sending this message WHEN the button is pushed instead of constantly?
There are several ways. One is to look at the state change detection example, to deal with the situation where the switch BECOMES pressed, not IS pressed.