websocket and ble
Dependencies: WebSocketClient WiflyInterface mbed
main.cpp
- Committer:
- mbedschool
- Date:
- 2015-02-07
- Revision:
- 0:92abfdf28c93
File content as of revision 0:92abfdf28c93:
#include "mbed.h" Serial device(p9,p10); DigitalOut led1(LED1); DigitalOut led2(LED2); #include "WiflyInterface.h" #include "Websocket.h" WiflyInterface wifly(p13, p14, p19, p26, "WWNet", "mmmmmmmm", WPA); char buf[10]; int main() { wifly.init(); //Use DHCP while (!wifly.connect()); led1=1; Websocket ws("ws://sockets.mbed.org/ws/mbedschool/viewer"); while (!ws.connect()); led2=1; ws.send("ws connect"); int i=0; //set mbed baud rate the same as BLE mini baud rate device.baud(38400); //simple polling demonstrate serial communication while(1) { if(device.readable()) { char data[1]; data[0] = device.getc(); ws.send(data); i++; } wait(0.1); } }