Running project 4 from the Arduino Workshop book, digitalRead returns LOW until the button is pushed, then it returns HIGH for far longer than the button is pushed. I have this problem with multiple buttons and on other projects. I have wired my project exactly as per the circuit diagram, not the picture which is lacking a 5V supply to the switch. How do I get a 6mm momentary push button to return LOW when it's not pushed?
We don't all have the book, so it's always a good idea to post the schematic and the code.
I'm guessing it's something to do with the (lack of) pullup or pulldown resistors, but please post more detail so we can help.
Welcome to the forum ![]()
If the switch is active high you will need a physical pull-down resistor. If the switch
is active low you can use the on-chip pull-up resistors via
pinMode (pin, INPUT_PULLUP) ;