Plotly Online-Analytik und Datenvisualisierungstool Beispiel

Dependencies:   EthernetInterface mbed-rtos mbed plotly

Fork of PlotlySensorChart by th.iotkit2.ch

Plotly ist ein Online-Analytik und Datenvisualisierungstool. Plotly bietet Werkzeuge für Online-Grafiken, Analysen und Statistiken sowie wissenschaftliche Grafik-Bibliotheken für Python , R , MATLAB , Perl , Julia , Arduino und REST.

Weitere Informationen zum Anpassen des Charts etc. siehe Arduino Tutorial (scrollen nach Usage and Docs)

plot.ly verwendet Username, API Key zusammen mit Tokens zur Eindeutigen Authentifizierung.

Das Chart ist nach laden des Programmes auf folgender Adresse abrufbar: https://plot.ly/~mc-b/11

Revision:
0:c7329ea5d8d5
Child:
1:5e7145bb2184
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jul 11 10:11:00 2014 +0000
@@ -0,0 +1,72 @@
+
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "plotly.h"
+
+Serial pc(USBTX,USBRX);
+
+EthernetInterface eth;
+
+// plotly account details
+char PlotlyUsername[] =  "YoutUsername";
+char PlotlyAPIToken[] = "YourAPIKey";
+char streaming_token[] = "YourStreamToken";
+char fileName[] = "Mbed Test Chart";
+
+plotly graph = plotly(PlotlyUsername, PlotlyAPIToken, streaming_token, fileName);
+
+void plotSetup()
+{
+    graph.log_level = 2; // turn on status output
+    graph.maxpoints = 72;
+    if (graph.init()) {
+        graph.openStream();
+    }
+
+}
+
+// Generate a sample chart
+void plotGenerateDataPoint()
+{
+    static  int counter = 0;
+    float yValue = sin(counter*3.14159/180);
+    graph.plot(counter, yValue);
+    counter+=5;
+}
+
+
+int main()
+{
+    pc.baud(115200);
+
+    pc.printf("Connecting network...\n");
+
+    eth.init();
+    eth.connect();
+
+    char *ipAddress = eth.getIPAddress();
+    if (ipAddress && (strlen(ipAddress) > 4)) {
+
+        pc.printf("IP Address is %s\n",eth.getIPAddress());
+        pc.printf("Initalise plot..\n");
+
+        plotSetup();
+
+        pc.printf("Generating data, press any key to abort.\n");
+        while (!pc.readable()) {
+            plotGenerateDataPoint();
+            wait(0.5);
+            }
+        graph.closeStream();
+
+    } else
+        pc.printf("No IP Address\n");
+
+    eth.disconnect();
+
+    pc.printf("Done\n");
+
+    while (1) {
+      wait(10);
+    }
+}
\ No newline at end of file