Dependencies:   EthernetNetIf TextLCD mbed DNSResolver

Files at this revision

API Documentation at this revision

Comitter:
takahashim
Date:
Mon Feb 27 06:55:17 2012 +0000
Commit message:

Changed in this revision

DNSResolver.lib Show annotated file Show diff for this revision Revisions of this file
EthernetNetIf.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
Websocket.lib Show annotated file Show diff for this revision Revisions of this file
Wifly.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 56b32aba8939 DNSResolver.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DNSResolver.lib	Mon Feb 27 06:55:17 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/hlipka/code/DNSResolver/#097d4993dd1e
diff -r 000000000000 -r 56b32aba8939 EthernetNetIf.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Mon Feb 27 06:55:17 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
diff -r 000000000000 -r 56b32aba8939 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon Feb 27 06:55:17 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r 56b32aba8939 Websocket.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Websocket.lib	Mon Feb 27 06:55:17 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/samux/code/Websocket/#2c4462ca74fa
diff -r 000000000000 -r 56b32aba8939 Wifly.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Wifly.lib	Mon Feb 27 06:55:17 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/samux/code/Wifly/#f524a28790b1
diff -r 000000000000 -r 56b32aba8939 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 27 06:55:17 2012 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "Websocket.h"
+#include "TextLCD.h"
+
+#define WS_SERVER_URL "ws://sockets.mbed.org/ws/webdbpress/rw"
+
+Websocket *ws;
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+AnalogIn ain(p15);
+float temp;
+
+int main() {
+    int i = 0;
+    char buf[512];
+    Timer timer;
+
+    lcd.printf("init network...\n");
+    ws = new Websocket(WS_SERVER_URL);
+
+    lcd.printf("connecting...\n");
+    while(!ws->connect()) {
+        printf("retrying...\r\n");
+        wait(5);
+    }
+
+    timer.start();
+    while(1) {
+        Net::poll();
+        wait(0.1);
+
+        if (timer.read_ms() >= 10000) {
+            temp = ain * 3.3 * 100;
+            sprintf(buf, "No.%d: temp:%4.2f", i++, temp);
+            ws->send(buf);
+            timer.reset();
+        }
+        
+        if (ws->read(buf)) {
+            lcd.cls();
+            lcd.printf("recv: %s\n", buf);
+        }
+
+        if (! ws->connected()) {
+            lcd.cls();
+            lcd.printf("disconnected\n");
+            break;
+        }
+    }
+}
diff -r 000000000000 -r 56b32aba8939 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 27 06:55:17 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5364839841bd