![](/media/cache/group/ep_srxDLMd.webp.50x50_q85.jpg)
Plotly Online-Analytik und Datenvisualisierungstool Beispiel
Dependencies: EthernetInterface mbed-rtos mbed plotly
Fork of PlotlySensorChart by
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
main.cpp
- Committer:
- stefan1691
- Date:
- 2015-03-27
- Revision:
- 3:f88ff0acc0b1
- Parent:
- 2:99852a7499da
- Child:
- 4:ca50b0858165
File content as of revision 3:f88ff0acc0b1:
/** Plotly Cloud Dienst mit Sensorwerten */ #include "mbed.h" #include "EthernetInterface.h" #include "plotly.h" Serial pc(USBTX,USBRX); EthernetInterface eth; // Sensoren (Poti, Light, Hall) AnalogIn sensors[] = { A0, A1, A2 }; // plotly account details const int numberOfTraces = 3; const char PlotlyUsername[] = "mc-b"; const char PlotlyAPIToken[] = "ggngm3tplt"; const char *PlotlyStreamingTokens[numberOfTraces] = {"9vdxtza25l","0pfcxy8fp3", "mpyq3oowhe"}; // or {"YourStreamToken"} for a single line. Must match numberOfTraces const char PlotlyFileName[] = "Mbed Test Chart"; plotly graph = plotly(PlotlyUsername,PlotlyAPIToken, PlotlyStreamingTokens, PlotlyFileName, numberOfTraces); void plotSetup() { graph.log_level = 1; // turn on status output graph.maxpoints = 72; if (graph.init()) graph.openStreams(); } // Generate some simple sample data points void plotGenerateDataPoint() { static float counter = 0; // generate a series of sine waves with slightly different frequencies. for (int i = 0; i < numberOfTraces; i++) graph.plot(counter, sensors[i].read(), i); counter+=0.2f; } /** Hauptprogramm */ int main() { 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(2.0); } graph.closeStreams(); } else pc.printf("No IP Address\n"); eth.disconnect(); pc.printf("Done\n"); return ( 0 ); }