EKG 2Channel

Dependencies:   mbed

Hello this a simple program that reads the ADC Value of pin A0 and A1 and displays them on the serial port /media/uploads/wehner334/ekg_andreas.xlsx

Revision:
2:153e3258be9b
Parent:
1:6e80ddd10594
diff -r 6e80ddd10594 -r 153e3258be9b main.cpp
--- a/main.cpp	Wed Feb 17 13:24:58 2016 +0000
+++ b/main.cpp	Fri Feb 26 10:09:06 2016 +0000
@@ -7,12 +7,16 @@
 AnalogIn analog_zero(A0);
 AnalogIn analog_one(A1);
 //DigitalOut led1(LED1);
+Timer Timerone;
 float meas[2];
+int Timervalue=0;
 void measuereandsend() {
+     Timervalue=Timerone.read_ms();
      meas[0] = analog_zero.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
-    // meas[1] = analog_one.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
-        meas[0] = meas[0] * 3300; // Change the value to be in the 0 to 3300 range
-        pc.printf(" %.0f \n", meas[0]);
+    meas[1] = analog_one.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
+        meas[0] = meas[0] * 3300;
+        meas[1]=meas[1]*3300; // Change the value to be in the 0 to 3300 range
+        pc.printf("%i, %.0f,%.0f\n",Timervalue, meas[0],meas[1]);
        // printf(" %.0f \n", meas[1]);
     //led1 = !led1;
 }
@@ -22,8 +26,8 @@
     }
 */
 int main() {
-    
-    pc.baud(57600);
+    Timerone.start();
+    pc.baud(230400);
     // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
    // mypwm.period(1000.0);
     //mypwm.write(0.001);
@@ -31,6 +35,8 @@
     //toggle_led_ticker.attach(&measuereandsend, 0.001);
     
     while (true) {
+        if(Timervalue>1000)
+        {Timerone.reset();}
         measuereandsend();