An example program that establishes a read-only web socket connection, and echos everything it sees to the LCD
Dependencies: C12832_lcd SprintUSBModem WebSocketClient mbed-rtos mbed
Fork of SprintUSBModemWebsocketTest-Temp by
Diff: main.cpp
- Revision:
- 1:380f5db5d004
- Parent:
- 0:162f8f714dcc
- Child:
- 2:72c06f2902d5
--- a/main.cpp Tue Oct 30 10:01:33 2012 +0000 +++ b/main.cpp Wed Oct 31 19:32:31 2012 +0000 @@ -1,12 +1,16 @@ #include "mbed.h" #include "SprintUSBModem.h" #include "Websocket.h" +#include "LM75B.h" void test(void const*) { + LM75B tmp(p28,p27); + SprintUSBModem modem(p18); Websocket ws("ws://sockets.mbed.org:443/ws/demo/rw"); char recv[128]; + char msg[32]; Thread::wait(5000); printf("Switching power on\r\n"); @@ -27,7 +31,8 @@ { if(!(i%100)) { - int ret = ws.send("WebSocket Hello World!"); + sprintf(msg, "Temp = %.1f",tmp.read()); + int ret = ws.send(msg); if(ret<0) { printf("Timeout\r\n");