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

main.cpp

Committer:
wehner334
Date:
2016-02-26
Revision:
2:153e3258be9b
Parent:
1:6e80ddd10594

File content as of revision 2:153e3258be9b:

#include "mbed.h"

//Ticker toggle_led_ticker;
Ticker debug_ticker;
Serial pc(SERIAL_TX, SERIAL_RX);
PwmOut mypwm(D9);
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;
        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;
}

/*void debugprint()
{pc.printf("%.0f  \n", 5000.0);
    }
*/
int main() {
    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);
    //debug_ticker.attach(&debugprint, 1.0);
    //toggle_led_ticker.attach(&measuereandsend, 0.001);
    
    while (true) {
        if(Timervalue>1000)
        {Timerone.reset();}
        measuereandsend();
        
        
        // Do other things...
    }
}