10 years, 5 months ago.

websocket server graph

I want display a wave form on a real time graph using mbeds websocket server like in this example, http://mbed.org/cookbook/Internet-of-Things-Demonstration. If I understand it correctly if I use the following code the server would automatically create a graph named ECG with the axis automatically adjusted? (Assume fecg is continuous changing) Therefore I would not need to do anything server side? and if I would need to do something server side or even if I do not, how would I go about that assuming I am using windows?

ecg graph

#include "mbed.h"
#include "EthernetInterface.h"
#include "Websocket.h"

int main()
{

char recv[100];

EthernetInterface eth;
eth.init();
eth.connect();
printf("IP Address is %s\n\r", eth.getIPAddress());

Websocket ws("ws://sockets.mbed.org:443/ws/ecg/wo");
ws.connect();

while (1)
{
sprintf (recv, "{\"id\":\"ECG\",\"ecg\":%d}", (int) fecg());
ws.send(recv);
}  

Hello,

I have not run the IoT demostration. My assumption based on zip archive there, you need to implement your own websocket server where you place those files from folder website which is part of the archive.

Have you run it with mbed's websocket?

Regards,
0xc0170

posted by Martin Kojtal 18 Nov 2013

I gave it a go, the html/js files are set up to use mbed's server so you don't need your own for the demo to work. You do need PHP if you want the smartphone interface to work tho.

posted by Carl - SolderSplash Labs 18 Nov 2013

Thanks for the replys. I havent run it myself since I still need to receive some parts. Any idea how I can to get to changing it for smart phones or other features like alarms if the graph exceeds a certain value? Would I need to use eclipse?

posted by Johann Hur 18 Nov 2013
Be the first to answer this question.