Whitworth-EN173-2016
/
SmartRise_MBED
Alarm Clock
Fork of SmartRise_MBED by
main.cpp@1:989eb818d3a3, 2016-01-24 (annotated)
- Committer:
- asloop18
- Date:
- Sun Jan 24 01:53:04 2016 +0000
- Revision:
- 1:989eb818d3a3
- Parent:
- 0:dd224b695d95
- Child:
- 2:261fce57a100
LCD displaying day date and 12-hr time on LCD,; RTC clock programmed in terminal
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 | 1:989eb818d3a3 | 10 | |
asloop18 | 1:989eb818d3a3 | 11 | while(1) { |
asloop18 | 1:989eb818d3a3 | 12 | time_t seconds = time(NULL); |
asloop18 | 1:989eb818d3a3 | 13 | |
asloop18 | 1:989eb818d3a3 | 14 | char buffer[32]; |
asloop18 | 1:989eb818d3a3 | 15 | strftime(buffer, 32, "%a%m/%d %I:%M%p \n", localtime(&seconds)); //day, #month/#day Hr:min (AP)M |
asloop18 | 1:989eb818d3a3 | 16 | lcd.printf("%s", buffer); |
asloop18 | 1:989eb818d3a3 | 17 | |
asloop18 | 1:989eb818d3a3 | 18 | wait(1); |
asloop18 | 1:989eb818d3a3 | 19 | } |
asloop18 | 1:989eb818d3a3 | 20 | } |