Buttons Always showing depressed in the serial monitor

I'm following the arduino button guide

I have 4 buttons connected to digital pins 2, 3, 4, 5
each button is connected with a 10K pull-down resistor
just like the diagram in the instructions

Here is my code:

const byte left_btn = 2;
const byte right_btn = 3;
const byte a_btn = 4;
const byte b_btn = 5;

void setup() { 

    pinMode(left_btn, INPUT);
    pinMode(right_btn, INPUT);
    pinMode(a_btn, INPUT);
    pinMode(b_btn, INPUT);

void loop() {

    if (digitalRead(left_btn) == HIGH) {
    if (digitalRead(right_btn) == HIGH) {
    if (digitalRead(a_btn) == HIGH) {
    if (digitalRead(b_btn) == HIGH) {


When I run this and start up the terminal I see leftrightableftrightableftrightab . . . ad infinitum, even though I haven't pressed a button.
What mistake(s) did I make, please?

Your breadboard power rails need jumpers in the middle.

BTW, you can use the internal pull-up resistors with a switch.

Ha, it's been about 2 years since I've messed with any MCUs and I made the same mistake about the power jumpers before. Of course it works now, but is there a modification I can make to have it register each push only once?
Thank you

Also I will look into using the internal pull-up. Guess I will have to check for LOW instead of HIGH.
Thanks again


What you do is look at ‘Switch Changes in State’ rather than the ‘switch level’.

There is a ‘Change in State’ sketch in the IDE examples.

BTW, thank you for properly showing a schematic, showing your wiring and properly attaching your code.

Change in state, fantastic tip

Making a 16X32 led display with a many atari-style games as I can cram into 32K
I will share the progress in the correct area of the forum.

The change in state will work for the click buttons. I'm adding a joystick for movement. I imagine that will want continuous reporting like I currently have.

Any other tips or reading you can recommend?

Happy to follow forum guidelines. I contribute to many other programming forums, been programming for 34 years.