Whitworth-EN173-2016
/
SmartRise_MBED
Alarm Clock
Fork of SmartRise_MBED by
main.cpp@2:261fce57a100, 2016-01-24 (annotated)
- Committer:
- asloop18
- Date:
- Sun Jan 24 02:03:50 2016 +0000
- Revision:
- 2:261fce57a100
- Parent:
- 1:989eb818d3a3
- Child:
- 3:51b248042aa0
Working Alarm setting shown (OB setting TBI)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asloop18 | 1:989eb818d3a3 | 1 | //8.3 LCD control with MBED main. |
asloop18 | 1:989eb818d3a3 | 2 | |
asloop18 | 1:989eb818d3a3 | 3 | #include "mbed.h" |
asloop18 | 1:989eb818d3a3 | 4 | #include "LCD.h" |
asloop18 | 1:989eb818d3a3 | 5 | #include "TextLCD.h" |
asloop18 | 1:989eb818d3a3 | 6 | |
asloop18 | 1:989eb818d3a3 | 7 | TextLCD lcd(p27,p28,p23,p24,p25,p26); |
asloop18 | 1:989eb818d3a3 | 8 | |
asloop18 | 1:989eb818d3a3 | 9 | int main() { |
asloop18 | 2:261fce57a100 | 10 | int Ahr,Amin; |
asloop18 | 1:989eb818d3a3 | 11 | while(1) { |
asloop18 | 1:989eb818d3a3 | 12 | time_t seconds = time(NULL); |
asloop18 | 1:989eb818d3a3 | 13 | |
asloop18 | 2:261fce57a100 | 14 | Ahr=11;Amin=30; |
asloop18 | 1:989eb818d3a3 | 15 | char buffer[32]; |
asloop18 | 2:261fce57a100 | 16 | strftime(buffer, 32, "%a%m/%d %I:%M%p", localtime(&seconds)); //day, #month/#day Hr:min (AP)M |
asloop18 | 2:261fce57a100 | 17 | wait(0.1); |
asloop18 | 2:261fce57a100 | 18 | lcd.printf("%s Alarm:%I:%I", buffer, Ahr, Amin); |
asloop18 | 1:989eb818d3a3 | 19 | |
asloop18 | 1:989eb818d3a3 | 20 | wait(1); |
asloop18 | 1:989eb818d3a3 | 21 | } |
asloop18 | 1:989eb818d3a3 | 22 | } |