As I have been getting less and less time to create videos and write articles I won’t be writing an article about this video. I will simply provide the video instruction and the code, I hope this is still helpful.
Watch the Video
View the Code
// setup pins const char BUTTON_PIN = 8; bool pressed = false; void setup() { Serial.begin(115200); // Setup pin modes pinMode(BUTTON_PIN, INPUT_PULLUP); } void loop() { // Read button bool currentState = digitalRead(BUTTON_PIN); if (currentState == pressed) { Serial.println("Hello"); while(digitalRead(BUTTON_PIN) == pressed) { // Do nothing while button is pressed } } }
It is not working
I’m going to need a little more info if you’re looking for help ha ha. Are you getting some sort of error or is the button just not responding at all? There are a few tips I can give you over text that might help figure out the problem so let me know the details when you get a chance. Thanks for commenting.