Question
Arduino alarm clock code I am working on a alarm clock using arduino. The alarm is supposed to go off once the current time is
Arduino alarm clock code
I am working on a alarm clock using arduino.
The alarm is supposed to go off once the current time is equal to the alarm time and is suppossed to stay on untill the user either presses the snooze or off buttton.
I need help turning off the alarm once the user presses the ahours buttton, with my current code the alarm turns off if you press the ahours button after 1 min. The break statement doesnt seem to work.
if (ahours == hours && amins == mins && amins != 0) { while(digitalRead(minBtn)==LOW && digitalRead(hourBtn)==LOW) { int potVal = analogRead(potVol); int newVal = map(potVal, 0, 255, 0, 1024); lcd.clear(); lcd.setCursor(5,0); lcd.print("ALARM!"); tone (buzzer, newVal); delay(500); lcd.clear(); noTone(buzzer); delay(500); Serial.print(newVal); if(digitalRead(minBtn) == HIGH) //snooze { noTone(buzzer); snooze(); }
if(digitalRead(hourBtn) == HIGH) //turn alarm off { noTone(buzzer);
break;
} } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started