df

Dependencies:   mbed mbedWSEsbc

Files at this revision

API Documentation at this revision

Comitter:
m170984
Date:
Tue Sep 29 01:28:19 2015 +0000
Commit message:
code and shit

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
mbedWSEsbc.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r f303c63965dd main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Sep 29 01:28:19 2015 +0000
@@ -0,0 +1,51 @@
+//MIDN 2/C Chau
+//Take a temp reading from sensor and send it to MatLab for analysis
+//ES305 Lab2
+#include "mbed.h"
+#include "mbedWSEsbc.h"
+
+float dt; // total change in time
+float totaltime = 5; // total sampling time
+float Ts = 0.01; // sampling period
+int repeat = 17; //Boolean for yes or no
+float Time = 0; // time object
+float measurement = 0; //The measured voltage of the thermocouple
+
+int main()
+{
+    mbedWSEsbcInit(19200); //set baud rate
+    Time = 0; // reset time var
+    t.reset(); // reset time object
+    pc.printf("Enter 1 to begin the loop:\n\r");
+    pc.scanf("%d", &repeat);
+    pc.printf("Enter total sampling time(sec):\n\r");
+    pc.scanf("%f", &totaltime);
+    pc.printf("Enter sampling period(sec):\n\r");
+    pc.scanf("%f", &Ts);
+    while (repeat ==1)
+    {
+        Time = 0; // reset time var
+        t.reset(); // reset time object
+        
+        while (Time <= totaltime)
+        {
+            t.start(); // start timing object
+        
+            measurement = read_max1270_volts(6,0,0); //read from the device
+            pc.printf("%f,%f\n", Time, measurement); // print measurement
+        
+            Time = Time + Ts; // increment time
+        
+            dt = Ts - t.read(); // calculate elapsed time
+            wait(dt); // wait
+        
+            t.reset(); //restart timing object     
+        }
+        pc.printf("Enter 1 to begin the loop:\n\r");
+        pc.scanf("%d", &repeat);
+        pc.printf("Enter total sampling time(sec):\n\r");
+        pc.scanf("%f", &totaltime);
+        pc.printf("Enter sampling period(sec):\n\r");
+        pc.scanf("%f", &Ts);
+    } 
+}
\ No newline at end of file
diff -r 000000000000 -r f303c63965dd mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Sep 29 01:28:19 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013
\ No newline at end of file
diff -r 000000000000 -r f303c63965dd mbedWSEsbc.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedWSEsbc.lib	Tue Sep 29 01:28:19 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/jebradshaw/code/mbedWSEsbc/#9041603c430e