NTPClient using the mbed_official WiflyInterface

Dependencies:   NTPClient WiflyInterface mbed

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Fri Aug 24 15:26:15 2012 +0000
Child:
1:8b6ea44e02bb
Commit message:
NTPClient with the mbed_official WiflyInterface

Changed in this revision

NTPClient.lib Show annotated file Show diff for this revision Revisions of this file
WiflyInterface.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.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NTPClient.lib	Fri Aug 24 15:26:15 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/NTPClient/#881559865a93
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WiflyInterface.lib	Fri Aug 24 15:26:15 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/WiflyInterface/#fb4494783863
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Aug 24 15:26:15 2012 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "WiflyInterface.h"
+#include "NTPClient.h"
+
+/* wifly interface:
+*     - p9 and p10 are for the serial communication
+*     - p19 is for the reset pin
+*     - p26 is for the connection status
+*     - "mbed" is the ssid of the network
+*     - "password" is the password
+*     - WPA is the security
+*/
+WiflyInterface wifly(p28, p27, p25, p26, "mbed", "password", WPA);
+NTPClient ntp;
+
+int main() 
+{
+    wifly.init(); //Use DHCP
+
+    wifly.connect();
+   
+    printf("Trying to update time...\r\n");
+    if (ntp.setTime("0.pool.ntp.org") == 0)
+    {
+      printf("Set time successfully\r\n");
+      time_t ctTime;
+      ctTime = time(NULL);
+      printf("Time is set to (UTC): %s\r\n", ctime(&ctTime));
+    }
+    else
+    {
+      printf("Error\r\n");
+    } 
+   
+    wifly.disconnect();  
+
+    while(1) {
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Aug 24 15:26:15 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6
\ No newline at end of file