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.
main.cpp
- Committer:
- WarwickRacing
- Date:
- 2010-11-28
- Revision:
- 0:5bd82da0cad9
File content as of revision 0:5bd82da0cad9:
#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); } }