Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GSwifi_tcpserver by
Revision 0:f4c1a7a895ee, committed 2012-08-21
- Comitter:
- gsfan
- Date:
- Tue Aug 21 07:26:08 2012 +0000
- Child:
- 1:fdc165a4df04
- Commit message:
- 1st build
;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GSwifi.lib Tue Aug 21 07:26:08 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/gsfan/code/GSwifi/#a423f0d197de
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Aug 21 07:26:08 2012 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "GSwifi.h"
+
+#define PORT 10080
+
+#define SECURE GSSEC_WPA_PSK
+#define SSID "SSID"
+#define PASS "password"
+
+GSwifi gs(p13, p14, p12, P0_22); // TX, RX, CTS, RTS
+Serial pc(USBTX, USBRX);
+DigitalOut led1(LED1), led2(LED2);
+
+void onGsReceive (int cid, int len) {
+ int i;
+ char buf[100];
+ Host host;
+
+ led2 = 1;
+
+ i = gs.recv(cid, buf, sizeof(buf));
+ gs.send(cid, buf, i);
+ pc.printf("recv %d\r\n", i);
+}
+
+int main () {
+ IpAddr ipaddr, netmask, gateway, nameserver;
+
+ led1 = 1;
+ pc.baud(115200);
+
+ pc.printf("connect\r\n");
+ if (gs.connect(SECURE, SSID, PASS)) {
+ return -1;
+ }
+ gs.getAddress(ipaddr, netmask, gateway, nameserver);
+ pc.printf("ip %d.%d.%d.%d\r\n", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
+
+ pc.printf("listen\r\n");
+ gs.listen(PORT, GSPROT_TCP, &onGsReceive);
+
+ for (;;) {
+ gs.poll();
+
+ wait_ms(50);
+ led1 = !led1;
+ led2 = 0;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Aug 21 07:26:08 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6 \ No newline at end of file
