Dependencies:   NTPClient_NetServices mbed ZG2100NetIf

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Fri Jul 09 15:33:37 2010 +0000
Child:
1:56dd9753b50d
Commit message:

Changed in this revision

HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
NTPClient.lib Show annotated file Show diff for this revision Revisions of this file
ZG2100NetIf.lib Show annotated file Show diff for this revision Revisions of this file
ZG2100NetIfExample.cpp.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/HTTPClient.lib	Fri Jul 09 15:33:37 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPClient/#d97a4fc01c86
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NTPClient.lib	Fri Jul 09 15:33:37 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/NTPClient/#7c3f1199256a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ZG2100NetIf.lib	Fri Jul 09 15:33:37 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/ZG2100NetIf/#e02ec42cf9c8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ZG2100NetIfExample.cpp.cpp	Fri Jul 09 15:33:37 2010 +0000
@@ -0,0 +1,74 @@
+#include "mbed.h"
+
+DigitalOut led(LED1);
+
+#include "zg2100NetIf.h"
+#include "NTPClient.h"
+#include "HTTPClient.h"
+
+Serial pc(USBTX, USBRX);
+
+const byte wep_key[5] = {0x01, 0x02, 0x03, 0x04, 0x05};
+
+ZG2100NetIf wifi(p5, p6, p7, p8, p9, p10); 
+HTTPClient http;
+NTPClient ntp;
+  
+
+int main() {
+
+  pc.baud(115200);
+  
+  printf("Start\n");
+  
+  wifi.init();
+  
+  printf("Init\n");
+
+  wifi.setSsid("mbed");
+  //wifi.setWpaPass("thisismypassphrase");
+  wifi.setWepKey(wep_key, 5);
+  
+  ZG2100Err result = wifi.connect( ZG_BSS_INFRA, ZG_SECURITY_WEP );
+ 
+  printf("Connection result %d\n", result);
+  
+  if( result > 1 )
+  {
+    printf("Connection error\n");
+    error("\n");
+  }
+
+  wifi.setup();
+  
+  printf("Setup.\n");
+  
+  time_t ctTime = time(NULL);  
+  printf("Current time is : %s UTC\n", ctime(&ctTime));  
+
+  Host server(IpAddr(), 123, "0.uk.pool.ntp.org");
+  ntp.setTime(server);
+    
+  /*time_t*/ ctTime = time(NULL);  
+  printf("Time is now : %s UTC\n", ctime(&ctTime)); 
+  Net::poll();
+
+  HTTPText txt;
+  
+  HTTPResult r = http.get("http://mbed.org/media/uploads/donatien/hello.txt", &txt);
+  if(r==HTTP_OK)
+  {
+    printf("Result :\"%s\"\n", txt.gets()); 
+  }
+  else
+  {
+    printf("Error %d\n", r);
+  }  
+   
+  while(1) {
+    led = 1;
+    wait(0.2);
+    led = 0;
+    wait(0.2);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jul 09 15:33:37 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da