lab

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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
diff -r 000000000000 -r 451fa025f45e main.cpp
--- /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); 
+    }
+}
+
diff -r 000000000000 -r 451fa025f45e mbed.bld
--- /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