Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

Students also viewed these Databases questions

Question

1. Describe a dialectical approach to cultural transitions.

Answered: 1 week ago