Ebrahim Atya
/
grpass_clock
Group assignment alarm clock
Diff: main.cpp
- Revision:
- 11:8695cb20e94c
- Parent:
- 10:2a47ac757d14
- Child:
- 12:6b899d5bb944
--- a/main.cpp Fri May 24 01:00:16 2019 +0000 +++ b/main.cpp Fri May 24 07:08:55 2019 +0000 @@ -3,9 +3,8 @@ #include <string> using namespace std; -TextLCD lcd(p19, p20, p25, p22, p23, p24); -Ticker blinker_cursor, blinker_numer, blinker_menu, clock_viewer, check_alarm, sound_alarm; -// Initially we set joystick to intterupt. +TextLCD lcd(p19, p20, p25, p22, p23, p24); //rs, e, d4-d7 +Ticker blinker_cursor, blinker_numer, blinker_menu, clock_viewer, check_alarm, sound_alarm, just_alarm; InterruptIn joycenter(p14); InterruptIn up(p15); InterruptIn down(p12); @@ -472,12 +471,12 @@ { state_alarm = true; state_menu = false; - blinker_numer.attach(&alarm_disp,0.5); + just_alarm.attach(&alarm_disp,0.5); while(1) { wait(1); if(col == 3 && row ==1) { if(joycenter) { //Turn off Alarm and back to main menu - blinker_numer.detach();//stop alarm_disp + just_alarm.detach();//stop alarm_disp state_alarm = false; state_menu = true; alarm_up = false; @@ -489,7 +488,7 @@ } } else if(col == 9 && row == 1) {//Turn on Alarm and back to main menu if(joycenter) { - blinker_numer.detach(); + just_alarm.detach(); state_alarm = false; state_menu = true; alarm_up = true; @@ -602,6 +601,13 @@ */ int main() { + lcd.locate(0,0); + lcd.printf("Press button to start"); + while(1){ + if(joycenter){ + break; + } + } // Initial value for our cursor row =0 ; col=0 ; @@ -644,6 +650,7 @@ Every time we choose the option in any state, the default value for cursor is col=0 and row=0. This to avoid accidently go to another state. */ + setup_init(); main_menu(); }