Test code for the LCD display, should output sample date and time.

Dependencies:   TextLCD mbed

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

Revision:
8:5a3ea713ec88
Child:
9:2bc040a7e842
diff -r 9fb6a638e68e -r 5a3ea713ec88 updateDisplay.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/updateDisplay.cpp	Tue May 23 14:27:32 2017 +0000
@@ -0,0 +1,35 @@
+
+#include "mbed.h"
+#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
+
+
+void updateDisplay(int time, int date) {
+
+// Adjust format of time to reflect hours and minutes
+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;
+
+// Print correctly spaced values on the display
+
+    lcd.printf("Time %d:%d", hours, minutes);
+    
+    // Locate cursor to start of second line
+    
+    lcd.setAddress(0, 1);
+    
+    lcd.printf("Date %d/%d/%d", day, month, year);
+
+     
+  }    
+