~

Dependencies:   mbed SimpleRGB mbed-rtos 4DGL-uLCD-SE SDFileSystem wave_player

Revision:
4:4792f0db029a
Parent:
3:641770225c44
Child:
5:420cda7cbfc5
diff -r 641770225c44 -r 4792f0db029a main.cpp
--- a/main.cpp	Tue Oct 11 00:14:04 2016 +0000
+++ b/main.cpp	Tue Oct 11 01:18:40 2016 +0000
@@ -1,10 +1,12 @@
 #include "mbed.h"
 #include "rtos.h"
+#include "uLCD_4DGL.h"
 #include "SimpleRGB.h"
 
 #define SECOND 1000 // used with threads
 DigitalOut led(LED1); // test led
 
+uLCD_4DGL lcd(p13,p14,p12); 
 /* 1 init/declare
 
 Ticker first;
@@ -42,22 +44,43 @@
     // show reboot process, associated with clip of apple restart
     while (true) {
         // lock, print 'Rebooting!' to uLCD with "progress_bar" underneath
+        lcd.text_string("Rebooting", 2, 5, FONT_7X8, WHITE);
         // draw progress bar 8 sec
+        std::string progress("|");
+        for (int i = 0; i < 8; i++) {
+            lcd.text_string(progress, 2, 6, FONT_7X8, WHITE);
+            progress += '|';
+            wait(SECOND);
+        }
         // draw an ascii 'apple'
+        lcd.text_string("(_`_)", 2, 5, FONT_7X8, WHITE);
+        lcd.text_string("", 2, 6, FONT_7X8, WHITE);
         // unlock, wait for 52
+        wait(52*SECOND);
     }
 }
 
 // lcd thread
 void uLCD_status_thread(void const *args) {
     // show time with smile, frown, sad face at top right
+    set_time(1476146921);
     while (true) {
         // lock, update time at top right with smiley at top left
-        // unlock, wait for 20 sec
-        // lock, change to frown
+        time_t seconds = time(NULL);
+        char buffer[32];
+        strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
+        lcd.text_string(buffer, 5, 1, FONT_7X8, RED);
+        lcd.text_string(":-)", 1, 1, FONT_7X8, WHITE);
         // unlock, wait for 20 sec
+        wait(20*SECOND);
+        // lock, change to frown
+        lcd.text_string(">:|", 1, 1, FONT_7X8, WHITE);
+        // unlock, wait for 20 sec
+        wait(20*SECOND);
         // lock, change to sad
+        lcd.text_string(":-(", 1, 1, FONT_7X8, WHITE);
         // unlock, wait for 20 sec
+        wait(20*SECOND);
     }
 }