see: http://mbed.org/users/gsfan/notebook/GSwifiInterface/
Dependencies: GSwifiInterface mbed-rtos mbed
Revision 0:df7a1c6c0a81, committed 2013-10-31
- Comitter:
- gsfan
- Date:
- Thu Oct 31 08:41:09 2013 +0000
- Commit message:
- 1st build;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GSwifiInterface.lib Thu Oct 31 08:41:09 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/gsfan/code/GSwifiInterface/#7d8134e7df01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Oct 31 08:41:09 2013 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "GSwifiInterface.h"
+
+#define SEC GSwifi::SEC_WPA_PSK
+#define SSID "SSID"
+#define PASS "PASSPHRASE"
+
+#define ECHO_SERVER_ADDRESS "192.168.1.101"
+#define ECHO_SERVER_PORT 10000
+
+int main () {
+ GSwifiInterface gs(p13, p14, p12, P0_22, p20, NC);
+ printf("UDP Echo Client...\n");
+ gs.init(); //Use DHCP
+ if (gs.connect(SEC, SSID, PASS)) return -1; // join the network
+ printf("IP Address is %s\n", gs.getIPAddress());
+
+ UDPSocket sock;
+ sock.init();
+
+ Endpoint echo_server;
+ echo_server.set_address(ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT);
+
+ char out_buffer[] = "Hello World\n";
+ sock.sendTo(echo_server, out_buffer, sizeof(out_buffer));
+
+ char in_buffer[256];
+ int n = sock.receiveFrom(echo_server, in_buffer, sizeof(in_buffer));
+
+ in_buffer[n] = '\0';
+ printf("%s\n", in_buffer);
+
+ sock.close();
+
+ gs.disconnect();
+ while(1) {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Thu Oct 31 08:41:09 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#ee87e782d34f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 31 08:41:09 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/f37f3b9c9f0b \ No newline at end of file