Test code for the LCD display, should output sample date and time.
Fork of TextLCD_HelloWorld2 by
Diff: updateDisplay.cpp
- Revision:
- 9:2bc040a7e842
- Parent:
- 8:5a3ea713ec88
- Child:
- 10:72aef0816fc1
--- a/updateDisplay.cpp Tue May 23 14:27:32 2017 +0000 +++ b/updateDisplay.cpp Thu May 25 10:04:11 2017 +0000 @@ -3,33 +3,40 @@ #include "TextLCD.h" // Host PC Communication channels + Serial pc(USBTX, USBRX); // tx, rx -// LCD instantiation -TextLCD lcd(PTC7, PTC0, PTC3, PTC4, PTC5, PTC6); // 4bit bus: rs, e, d4-d7 +// LCD instantiation +TextLCD lcd(PTC7, PTC0, PTC3, PTC4, PTC5, PTC6); // 4bit bus: rs, e, d4-d7 + +int main() { + +// Initialise sample date and time -void updateDisplay(int time, int date) { + int time = 1234; + int date = 220517; // Adjust format of time to reflect hours and minutes -int hours = time/100; -int minutes = time - hours*100; + + int hours = time/100; + int minutes = time - hours*100; // Adjust format of date to reflect days and minutes -int day = date/10000; -int month = (date - day*10000)/100; -int year = date - month*100 - day*10000; + + int day = date/10000; + int month = (date - day*10000)/100; + int year = date - month*100 - day*10000; // Print correctly spaced values on the display lcd.printf("Time %d:%d", hours, minutes); - // Locate cursor to start of second line +// Locate cursor to start of second line lcd.setAddress(0, 1); lcd.printf("Date %d/%d/%d", day, month, year); - - } +}