Serial monitor false reading of input button

Hi there!

I am trying to incorporate a snooze button for an alarm clock I am building.
More info about that project here: Help with building an alarm clock with fading lights, music and a touch screen

I am having the problem that my Arduino seems to read a false input from my input button. (see this screen shot. I am not doing anything at this moment. And the SnoozePin gives back a 1...

I am using a standard press button that I connected to ground thourgh a 10K resistor, like this.
button schematic

When I measure the hardware with a multimeter the button seems to work fine. Therefore I think that I screwed up in my coding.

int SnoozePin = 8;
int Snooze_pressed;

void setup() {
  pinMode(SnoozePin, INPUT);

void loop() {
  Snooze_pressed = digitalRead(SnoozePin);
  Serial.print("Snooze:"); Serial.println(Snooze_pressed);
  //  Snooze_pressed == false;
  delay(100); // Bounce button

Does anybody know what I did wrong?
Thanks in advance!

For switch connections to the Arduino.

Maybe not.

What is the 10k resistor for?

Why didn't you use the built-in pullup resistors?

1 Like

It was a floating pin... @anon73444976 The pullup resistor comment made me google it and I found a very nice youtube tutorial explaining it.

Thanks for the help!


Thank you - you have just made my day!

1 Like

@nillad, your topic has been moved to a more suitable location on the forum. A little late, I know.

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