Smart Clock

Dependencies:   AlarmClock DigitalClock EthernetInterface FourDigitLED HTTPClient NTPClient SDFileSystem TrainStat WeatherInfo XML_aide mbed-rtos mbed picojson wolfSSL

Revision:
2:bcc1a40ffa04
Parent:
1:1a28aaca601d
Child:
3:2cb03c287c22
--- a/main.cpp	Fri Jun 26 08:02:30 2015 +0000
+++ b/main.cpp	Fri Jun 26 09:35:53 2015 +0000
@@ -3,8 +3,7 @@
 #include "EthernetInterface.h"
 #include "NTPClient.h"
 #include "AlarmClock.h"
-
-extern void net_main(void const *av) ;
+#include "TrainStat.h"
 
 AlarmClock alarmclock (                          
     /* Segment 0 - 6, Dot */    D11,D6, D3, D1, D0, D10,D4, D2 , 
@@ -12,6 +11,8 @@
     /* Alarm, Hour, Min, Tone */D13, D14, D15, PTC11
 )  ;
 
+TrainStat trainstat ;
+
 static void ntp(char *site)
 {
     NTPClient ntp;
@@ -36,6 +37,22 @@
     } 
 }
 
+void net_main(void const *av)
+{
+    bool sw ;
+
+    trainstat.setLine("千代田線") ;
+    wait(2.0) ;
+    while(1) {
+        sw = !sw ;
+        if(!trainstat.getStat())
+        {    printf("遅れあり\n") ; alarmclock.setBlink(true) ; }
+        else
+        {    printf("遅れなし\n") ; alarmclock.setBlink(false) ; }
+        wait(60.0) ;
+    }
+}
+
 int main() {
     EthernetInterface eth;
     int ret ;