1 / 9

Alarm Clock

Alarm Clock. Robert Stuart. Functions of an Alarm Clock. Keep track of time. When the time matches a stored value an alarm should go off. Functionality that allows for the user to set the time to a desired value. Functionality that allows for the user to set the alarm to a desired value.

kara
Download Presentation

Alarm Clock

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Alarm Clock Robert Stuart

  2. Functions of an Alarm Clock Keep track of time. When the time matches a stored value an alarm should go off. Functionality that allows for the user to set the time to a desired value. Functionality that allows for the user to set the alarm to a desired value. Allow for the alarm function to be enabled or disabled. Incorporate a snooze feature Display the time and the alarm time.

  3. Implementation Hours, Minutes, Seconds variables introduced by Phil. Needed to add in some code to have the hours operate in the 12-hr system and to keep track of am and pm. A simple test to see if the time and the stored alarm time are the same. 3/4. Use one on board button to switch between 3 modes: Running, Settime, and Setalarm. To be able to set the time or the alarm I used another 3 on board buttons; one to toggle between the hours and the minutes being selected, and the other two to increase or decrease the selected variable. 5. To ensure this function is not changed by accident, it requires two of the on board buttons to be pressed and released simultaneously. 6. An additional large button that when pressed disables the alarm for five minutes (from when the snooze button was pressed, not when the alarm first went off). 7. An LCD display allows for more information to be displayed in an easy to understand format. I have included the time (or alarm time), a decimal point to indicate the state of the alarm, another decimal point to show pm, and a letter to indicate what mode you are in.

  4. Layout

  5. Code – Start and Running Loop Set up input/output ports Declare and initialize all variables Running loop if change mode pressed goto Set Time loop if enable/disable alarm pressed switch the state of that variable if alarm is enabled goto tests for the alarm Goto Running

  6. Set Time Loop Set Time Loop if up button pressed increase current variable (either Hours or Minutes) if down button pressed decrease current variable (either Hours or Minutes) if Hr/Min button pressed toggle between the variables Hours and Minutes if enable/disable button pressed toggle enabled/disabled if mode button pressed goto Set Alarm loop Goto Set Time loop

  7. Set Alarm Loop Set Alarm Loop if up button pressed increase current variable (either AHR or AMI) if down button pressed decrease current variable (either AHR or AMI) if Hr/Min button pressed toggle between the variables AHR and AMI if enable/disable button pressed toggle enabled/disabled if mode button pressed goto Running loop Goto Set Alarm loop

  8. Tests for Alarm Test AM/PM if AM/PM matches for alarm and time goto test hours Return Test hours if Hours and AHR are the same gototest minutes Return Test minutes if Minutes and AMI are the same gototest seconds Return Test seconds if Seconds is 0 goto Alarming Loop! Return

  9. Alarming Loop! Alarming Loop if Snooze button has been pressed increase alarming variable by 5 minutes and goto Tests for Alarm if Snooze button hasn’t been pressed BEEP! if off button pressed turn alarm off and go back to Running if enable/disable button pressed turn alarm off, disable alarm function, and go back to Running Goto Alarming Loop

More Related