websocket and ble
Dependencies: WebSocketClient WiflyInterface mbed
Revision 0:92abfdf28c93, committed 2015-02-07
- Comitter:
- mbedschool
- Date:
- Sat Feb 07 06:08:45 2015 +0000
- Commit message:
- mbed websocket and BLE
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebSocketClient.lib Sat Feb 07 06:08:45 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/samux/code/WebSocketClient/#466f90b7849a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WiflyInterface.lib Sat Feb 07 06:08:45 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/WiflyInterface/#fb4494783863
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 07 06:08:45 2015 +0000 @@ -0,0 +1,38 @@ +#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); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 07 06:08:45 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file