websocket and ble

Dependencies:   WebSocketClient WiflyInterface mbed

Files at this revision

API Documentation at this revision

Comitter:
mbedschool
Date:
Sat Feb 07 06:08:45 2015 +0000
Commit message:
mbed websocket and BLE

Changed in this revision

WebSocketClient.lib Show annotated file Show diff for this revision Revisions of this file
WiflyInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 92abfdf28c93 WebSocketClient.lib
--- /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
diff -r 000000000000 -r 92abfdf28c93 WiflyInterface.lib
--- /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
diff -r 000000000000 -r 92abfdf28c93 main.cpp
--- /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);
+    }
+}
diff -r 000000000000 -r 92abfdf28c93 mbed.bld
--- /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