1122121

Dependencies:   7SegSRDriver_3 C12832_lcd EthernetInterface_youcef2 TimeZone mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
sefyou
Date:
Tue Jun 06 13:53:19 2017 +0000
Commit message:
op

Changed in this revision

7SegSRDriver.lib Show annotated file Show diff for this revision Revisions of this file
C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
TimeZone.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 3d909922074a 7SegSRDriver.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/7SegSRDriver.lib	Tue Jun 06 13:53:19 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/sefyou/code/7SegSRDriver_3/#5f76214d096c
diff -r 000000000000 -r 3d909922074a C12832_lcd.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Tue Jun 06 13:53:19 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r 000000000000 -r 3d909922074a EthernetInterface.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Tue Jun 06 13:53:19 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/sefyou/code/EthernetInterface_youcef2/#109bfc9af710
diff -r 000000000000 -r 3d909922074a TimeZone.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TimeZone.lib	Tue Jun 06 13:53:19 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/hlipka/code/TimeZone/#0c7207d674d3
diff -r 000000000000 -r 3d909922074a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 06 13:53:19 2017 +0000
@@ -0,0 +1,96 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "C12832_lcd.h"
+#include "Time.h"
+
+C12832_LCD lcd; //Graphics LCD
+ /*****************MAISON*****************/
+/*const char* ip= "192.168.1.49";
+const char* masque= "255.255.255.0";
+const char* gateway= "192.168.1.254";*/
+
+/*****************COUR*******************/
+const char* ip= "172.16.202.4";
+const char* masque= "255.255.0.0";
+const char* gateway= "172.16.0.5";
+
+const int MCAST_PORT = 8888;
+
+Timer heure;
+
+int main() {
+    /************HEURE********************/
+    EthernetInterface eth;
+    eth.init(ip,masque,gateway); //Use DHCP
+    eth.connect();
+    
+    UDPSocket sock;
+    sock.init();
+
+    Endpoint nist;
+    nist.set_address("utcnist.colorado.edu", 37);
+
+    char out_buffer[] = ""; // Does not matter
+    sock.sendTo(nist, out_buffer, sizeof(out_buffer));
+   
+    
+    char in_buffer[4];
+    int n = sock.receiveFrom(nist, in_buffer, sizeof(in_buffer)); 
+    unsigned int timeRes = ntohl( *((unsigned int*)in_buffer));
+  /************PREMIER SERVEUR ********************/
+    UDPSocket server;
+    server.bind(MCAST_PORT);
+    Endpoint client;
+    char data[256];
+
+    int heure01;
+    int heure02;
+    
+    int minute01;
+    int minute02;
+while (true)
+{
+           heure.start();
+    data[0] = 0;
+    server.receiveFrom(client, data, sizeof(data));   
+
+if(data[0]=='B' && data[1]=='U' && data[2] =='Z'  && data[3] == 'Z')
+{
+     lcd.cls();
+     lcd.printf("premier serveur !");
+}
+
+if(data[0]=='B' && data[1]=='A' && data[2] =='C'  && data[3] == 'K')
+{
+        //lcd.cls();
+        //lcd.printf("premier serveur22");
+        if (heure.read_ms()  >= 1000 )
+        {
+            set_time(timeRes);
+            time_t unixTime= time(NULL);
+            TimeStamp timeStamp(unixTime);
+            lcd.cls();
+            lcd.locate(1, 0);
+           // lcd.printf("heure :%d ------ minute :%d ",timeStamp.getHour()+2,timeStamp.getMinute());
+           
+                   heure01= ((timeStamp.getHour()+2) /10);
+                   heure02= ((timeStamp.getHour()+2) %10);
+                   
+                   minute01= ((timeStamp.getMinute()) /10);
+                   minute02= ((timeStamp.getMinute()) %10);
+                
+            
+            lcd.printf("heure1 :%d ------ heure2 :%d", heure01, heure02);
+            lcd.printf("\n");
+            lcd.printf("minute1 :%d ------ minute2 :%d", minute01, minute02);
+            lcd.printf("\n");
+            lcd.printf("%d",heure.read_ms());
+            timeRes+=1;
+            heure.reset();
+    
+        }
+    }
+}
+
+
+}
diff -r 000000000000 -r 3d909922074a mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Tue Jun 06 13:53:19 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d
diff -r 000000000000 -r 3d909922074a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 06 13:53:19 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file