Plotly Cloud Dienst mit Sensorwerten
Dependencies: EthernetInterface mbed-rtos mbed plotly
Fork of Plotly_HelloWorld by
Revision 2:99852a7499da, committed 2015-03-18
- Comitter:
- stefan1691
- Date:
- Wed Mar 18 12:51:58 2015 +0000
- Parent:
- 1:5e7145bb2184
- Commit message:
- Plotly Cloud Dienst mit Sensorwerten
Changed in this revision
diff -r 5e7145bb2184 -r 99852a7499da EthernetInterface.lib --- a/EthernetInterface.lib Tue Jul 29 13:55:43 2014 +0000 +++ b/EthernetInterface.lib Wed Mar 18 12:51:58 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#e6b79f0ccd95 +http://mbed.org/users/mbed_official/code/EthernetInterface/#2fc406e2553f
diff -r 5e7145bb2184 -r 99852a7499da main.cpp --- a/main.cpp Tue Jul 29 13:55:43 2014 +0000 +++ b/main.cpp Wed Mar 18 12:51:58 2015 +0000 @@ -1,11 +1,12 @@ - +/** 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; @@ -20,10 +21,8 @@ { graph.log_level = 1; // turn on status output graph.maxpoints = 72; - if (graph.init()) { + if (graph.init()) graph.openStreams(); - } - } // Generate some simple sample data points @@ -32,46 +31,40 @@ static float counter = 0; // generate a series of sine waves with slightly different frequencies. - for (int i = 0; i < numberOfTraces; i++) { - graph.plot(counter, (float)sin(counter * (1-i*0.1)), i); - } + for (int i = 0; i < numberOfTraces; i++) + graph.plot(counter, sensors[i].read(), i); - counter+=0.2; + counter+=0.2f; } - +/** Hauptprogramm */ int main() { - pc.baud(115200); - pc.printf("Connecting network...\n"); - eth.init(); eth.connect(); char *ipAddress = eth.getIPAddress(); - if (ipAddress && (strlen(ipAddress) > 4)) { - + 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()) { + while ( !pc.readable() ) + { plotGenerateDataPoint(); - wait(0.5); - } + wait(2.0); + } graph.closeStreams(); - } else + } + else pc.printf("No IP Address\n"); eth.disconnect(); - pc.printf("Done\n"); - - while (1) { - wait(10); - } + return ( 0 ); } \ No newline at end of file
diff -r 5e7145bb2184 -r 99852a7499da mbed-rtos.lib --- a/mbed-rtos.lib Tue Jul 29 13:55:43 2014 +0000 +++ b/mbed-rtos.lib Wed Mar 18 12:51:58 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#1520481a219c +http://mbed.org/users/mbed_official/code/mbed-rtos/#d3d0e710b443
diff -r 5e7145bb2184 -r 99852a7499da mbed.bld --- a/mbed.bld Tue Jul 29 13:55:43 2014 +0000 +++ b/mbed.bld Wed Mar 18 12:51:58 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file