Tests data at the analogue In. whilst the push button is being depressed (push button pulls input to ground when depressed). Writes this to a csv type file that can be opened in excel and graphed.
Diff: main.cpp
- Revision:
- 0:5bd82da0cad9
diff -r 000000000000 -r 5bd82da0cad9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 28 17:05:40 2010 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "DebouncedIn.h" + +LocalFileSystem local("local"); + +DebouncedIn ChangeUp(p15); //Debounced class creating digital input to invoke a gear change up +AnalogIn Position(p20); //Analogue input to read current position of actuator from POT + +int i = 0; + +int main() { + +while(1) + { + FILE *Datalogging = fopen("/local/testAnalogue.csv", "w"); + while(ChangeUp.falling()) + { + i++; + fprintf(Datalogging, "%.3f,%.3f\n",Position.read(),i); + } + fclose(Datalogging); + } +}