WebSocket Hello World using the wifly interface
Dependencies: WebSocketClient WiflyInterface mbed
main.cpp
00001 #include "mbed.h" 00002 #include "WiflyInterface.h" 00003 #include "Websocket.h" 00004 00005 00006 /* wifly interface: 00007 * - p9 and p10 are for the serial communication 00008 * - p19 is for the reset pin 00009 * - p26 is for the connection status 00010 * - "mbed" is the ssid of the network 00011 * - "password" is the password 00012 * - WPA is the security 00013 */ 00014 WiflyInterface wifly(p9, p10, p19, p26, "mbed", "password", WPA); 00015 00016 int main() { 00017 wifly.init(); //Use DHCP 00018 while (!wifly.connect()); 00019 printf("IP Address is %s\n\r", wifly.getIPAddress()); 00020 00021 Websocket ws("ws://sockets.mbed.org:443/ws/demo/wo"); 00022 while (!ws.connect()); 00023 00024 while (1) { 00025 ws.send("WebSocket Hello World over Wifly"); 00026 wait(1.0); 00027 } 00028 }
Generated on Wed Jul 27 2022 14:59:30 by 1.7.2