gs fan
/
GSwifi_httpd
HTTP server for GSwifi see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
main.cpp
- Committer:
- gsfan
- Date:
- 2012-11-01
- Revision:
- 0:540fed81e29b
- Child:
- 1:d0ec28e041d6
File content as of revision 0:540fed81e29b:
#include "mbed.h" #include "GSwifi.h" #define PORT 80 #define SECURE GSSEC_WPA_PSK #define SSID "SSID" #define PASS "passkey" GSwifi gs(p13, p14); // TX, RX (no flow control) // GSwifi gs(p13, p14, p12, P0_22); // TX, RX, CTS, RTS LocalFileSystem local("local"); Serial pc(USBTX, USBRX); DigitalOut led1(LED1), led2(LED2); int main () { IpAddr ipaddr, netmask, gateway, nameserver; Host host; 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]); led2 = 1; pc.printf("httpd\r\n"); gs.httpd(PORT); gs.attach_httpd("/test/", "/local/sample/"); gs.attach_httpd("/example/", "/local/"); gs.attach_httpd("/", "/local/"); for (;;) { gs.poll(); wait_ms(50); led1 = !led1; led2 = 0; } }