Problem with Arduino Button Circuit

I am a beginner at Arduino; I started about 1 month ago, though I have prior coding experience.

I tried making a simple circuit that accomplishes the following task: when a button is pressed, a message is printed to the Serial monitor in the Arduino IDE. However, I couldn't get this to work, and I'm not sure why.

The circuit is very simple: a jumper wire goes from the Arduino's digital pin #1 to J30 on the breadboard. On the breadboard, the button is placed on the pins D28/30 and F28/30, which means that the two rows of connected legs in the button are on rows 28 and 30 respectively. Finally, a jumper wire goes from J28 to the Arduino's GND Pin.

Here is an image of the circuit

Here is the code

However, when I ran the code, the circuit behaved strangely. When I pushed down on the button, nothing happened, but as soon as I let go of the button after pushing down on it, the Serial Monitor was flooded with the Serial.println statements.

Then, whenever I pressed down on the button again, the Serial statements would temporarily stop, but once I let go of the button, they continued to appear.

Why is the circuit behaving in this way? What should I do to fix it?

Hi @distraughtgrape ,
avoid use pin 0 or pin 1.
They are use by serial.
Select another pino from 2 to 13.

RV mineirin

Make sure the Serial Monitor Baud Rate is set to 9600 as in your sketch.

Always imbed images here on the forum.
Show your sketch as text, not an image, use the </> icon in the posting menu.

Even though this is a very simple project and question, it’s good chance to learn about posting your problem correctly.

I for one, won’t be opening links to any unverified sites, especially when it’s so easy to post properly formatted code on the forum.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.