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.
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);
Serial.begin(9600);
}
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!