WebSocket test using WiflyInterface Tested with FRDM-K64F
Dependencies: WebSocketClient WiflyInterface mbed
Fork of Websocket_Wifly_HelloWorld by
Diff: main.cpp
- Revision:
- 3:5c16d0d73e81
- Parent:
- 1:31e50fea8be8
diff -r c69a06fe81c0 -r 5c16d0d73e81 main.cpp --- a/main.cpp Fri Aug 24 14:06:31 2012 +0000 +++ b/main.cpp Fri Sep 12 02:09:55 2014 +0000 @@ -4,24 +4,32 @@ /* 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 +* - p9 (TX) and p10 (RX) are for the serial communication +* - p30 is for the reset pin +* - p29 is for the connection status +* - "ssid" is the ssid of the network * - "password" is the password * - WPA is the security */ -WiflyInterface wifly(p9, p10, p19, p26, "mbed", "password", WPA); +#if TARGET_LPC1768 +WiflyInterface wifly(p9, p10, p30, p29, "ssid", "password", WPA); +#else +WiflyInterface wifly(D1, D0, D3, D2, "ssid", "pasword", WPA); +#endif + +DigitalOut led(LED1); int main() { + printf("Wifly WebSocket test\n"); wifly.init(); //Use DHCP while (!wifly.connect()); - printf("IP Address is %s\n\r", wifly.getIPAddress()); + printf("IP Address is %s\n", wifly.getIPAddress()); - Websocket ws("ws://sockets.mbed.org:443/ws/demo/wo"); + Websocket ws("ws://sockets.mbed.org/ws/443/wo"); while (!ws.connect()); while (1) { + led = !led; ws.send("WebSocket Hello World over Wifly"); wait(1.0); }