Brady Dove
/
ResistiveSensors
lab
Revision 0:451fa025f45e, committed 2015-04-10
- Comitter:
- bdove16
- Date:
- Fri Apr 10 01:04:29 2015 +0000
- Commit message:
- 1111
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 10 01:04:29 2015 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" + +Serial s(USBTX, USBRX); //serial connection +AnalogIn photoIn(p20); //analog input pin20 and named PhotoIn +Timer t; //timer object for timestamp + +void setupSerial(void) +{ + s.baud(19200); //sets the BaudRate + s.format(7,SerialBase::Even,1); //set DataBits, Parity, and StopBits +} + +int main(void) +{ + setupSerial(); + + float time; //current time + float data; //current data + + + t.reset(); //resets timer + t.start(); //starts timer + + //Loop + int go = 1; + while(go==1) { + //Read data + data = photoIn.read(); + time= t.read(); + + //Print data to serial port + s.printf("%f,%f\n",time,data); + + wait(0.5); + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 10 01:04:29 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file