tes

Dependencies:   ASyncTicker EthernetInterface WebSocketClient mbed-rtos mbed MbedJSONValue xbee_lib

Files at this revision

API Documentation at this revision

Comitter:
ammanvedi
Date:
Mon Jan 27 21:50:20 2014 +0000
Child:
1:6c1df6c9be4d
Commit message:
initial

Changed in this revision

ASyncTicker.lib Show annotated file Show diff for this revision Revisions of this file
EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
WebSocketClient.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-rtos.lib 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ASyncTicker.lib	Mon Jan 27 21:50:20 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/hlipka/code/ASyncTicker/#13db8277ce26
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Mon Jan 27 21:50:20 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#6a67d2bddc7c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebSocketClient.lib	Mon Jan 27 21:50:20 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/samux/code/WebSocketClient/#4567996414a5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 27 21:50:20 2014 +0000
@@ -0,0 +1,58 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include <stdio.h>
+#include <string.h>
+#include "Websocket.h"
+#include "Updateable.h"
+#include "ASyncTicker.h"
+#define PORT   80
+
+
+EthernetInterface ethernet;
+Websocket ws("ws://192.168.0.4:8080/");
+Ticker pull_ticker;
+
+
+
+void pull_updates(){
+  wait(0.1f);
+  printf("%s", "hello");
+
+}
+
+int main ()
+{
+
+    ethernet.init();    // connect with DHCP
+    int ret_val = ethernet.connect();
+ 
+    if (0 == ret_val) {
+        printf("IP Address: %s\n\r", ethernet.getIPAddress());
+    } else {
+        error("ethernet failed to connect: %d.\n\r", ret_val);
+    }
+    
+    
+    ws.connect();
+    
+        char str[100];
+    // string with a message
+        sprintf(str, "PU");
+        ws.send(str);
+    
+        // clear the buffer and wait a sec...
+        memset(str, 0, 100);
+        wait(0.5f);
+    
+        // websocket server should echo whatever we sent it
+        if (ws.read(str)) {
+            printf("rcv'd: %s\n\r", str);
+        }
+        ws.close();
+        pull_ticker.attach(&pull_updates, 5.0);
+        while(1){
+            
+            wait(0.1f);
+            }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Mon Jan 27 21:50:20 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#f88660a9bed1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jan 27 21:50:20 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file