Websocket Test Program for W5500 (WIZ550io) FRDM-KL25Z WIZ550io Ethernet Board.
Dependencies: W5500Interface WebSocketClient mbed
Fork of Websocket_Ethernet_W5500 by
Websocket example using Ethernet component of WIZ550io (W5500). FRDM-KL25Z is used.
Diff: main.cpp
- Revision:
- 2:d6eb2ce07362
- Parent:
- 1:22e5197655a9
- Child:
- 3:4c02f6287752
diff -r 22e5197655a9 -r d6eb2ce07362 main.cpp --- a/main.cpp Tue Jul 08 06:03:03 2014 +0000 +++ b/main.cpp Tue Jul 08 08:37:08 2014 +0000 @@ -1,8 +1,10 @@ #include "mbed.h" #include "EthernetInterfaceW5500.h" #include "Websocket.h" +#include "DS18B20Sensor.h" DigitalOut myled(LED1); +DS18B20Sensor sensor(P1_25); int main() { @@ -56,10 +58,20 @@ ws.connect(); char str[100]; + char sensorBuf[25]; + uint8_t result; + uint8_t sensor_cnt; + sensor_cnt = sensor.count(); for(int i=0; i<0x10; ++i) { // string with a message - sprintf(str, "%d WebSocket for WIZnet W5500 Hello World over Ethernet", i); + result = sensor.startReading(true); // start sensor readings and wait + if (result == DS18X20_OK) { + sensor.getReading(sensorBuf, 0); // get result into buf + sprintf(str, "%d WebSocket for WIZnet W5500 Hello World over Ethernet : Current Temperature is %s", i, sensorBuf); + } else { + sprintf(str, "%d WebSocket for WIZnet W5500 Hello World over Ethernet", i); + } ws.send(str); // clear the buffer and wait a sec...