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:
2015-11-03
Revision:
0:b676db63060d
Child:
1:6e80ddd10594

File content as of revision 0:b676db63060d:

#include "mbed.h"

Ticker toggle_led_ticker;
Serial pc(SERIAL_TX, SERIAL_RX);
PwmOut mypwm(D9);
AnalogIn analog_zero(A0);
AnalogIn analog_one(A1);
//DigitalOut led1(LED1);
float meas[2];
void measuereandsend() {
     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]);
       // printf(" %.0f \n", meas[1]);
    //led1 = !led1;
}

int main() {
    
    pc.baud(57600);
    // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
    mypwm.period_ms(1000);
    mypwm.pulsewidth_ms(50);
    toggle_led_ticker.attach(&measuereandsend, 0.001);
    
    while (true) {
        // Do other things...
    }
}