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

Committer:
wehner334
Date:
Wed Feb 17 13:24:58 2016 +0000
Revision:
1:6e80ddd10594
Parent:
0:b676db63060d
Child:
2:153e3258be9b
Simple Ekg 2 Channel

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wehner334 0:b676db63060d 1 #include "mbed.h"
wehner334 0:b676db63060d 2
wehner334 1:6e80ddd10594 3 //Ticker toggle_led_ticker;
wehner334 1:6e80ddd10594 4 Ticker debug_ticker;
wehner334 0:b676db63060d 5 Serial pc(SERIAL_TX, SERIAL_RX);
wehner334 0:b676db63060d 6 PwmOut mypwm(D9);
wehner334 0:b676db63060d 7 AnalogIn analog_zero(A0);
wehner334 0:b676db63060d 8 AnalogIn analog_one(A1);
wehner334 0:b676db63060d 9 //DigitalOut led1(LED1);
wehner334 0:b676db63060d 10 float meas[2];
wehner334 0:b676db63060d 11 void measuereandsend() {
wehner334 0:b676db63060d 12 meas[0] = analog_zero.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
wehner334 0:b676db63060d 13 // meas[1] = analog_one.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
wehner334 0:b676db63060d 14 meas[0] = meas[0] * 3300; // Change the value to be in the 0 to 3300 range
wehner334 0:b676db63060d 15 pc.printf(" %.0f \n", meas[0]);
wehner334 0:b676db63060d 16 // printf(" %.0f \n", meas[1]);
wehner334 0:b676db63060d 17 //led1 = !led1;
wehner334 0:b676db63060d 18 }
wehner334 0:b676db63060d 19
wehner334 1:6e80ddd10594 20 /*void debugprint()
wehner334 1:6e80ddd10594 21 {pc.printf("%.0f \n", 5000.0);
wehner334 1:6e80ddd10594 22 }
wehner334 1:6e80ddd10594 23 */
wehner334 0:b676db63060d 24 int main() {
wehner334 0:b676db63060d 25
wehner334 0:b676db63060d 26 pc.baud(57600);
wehner334 0:b676db63060d 27 // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
wehner334 1:6e80ddd10594 28 // mypwm.period(1000.0);
wehner334 1:6e80ddd10594 29 //mypwm.write(0.001);
wehner334 1:6e80ddd10594 30 //debug_ticker.attach(&debugprint, 1.0);
wehner334 1:6e80ddd10594 31 //toggle_led_ticker.attach(&measuereandsend, 0.001);
wehner334 0:b676db63060d 32
wehner334 0:b676db63060d 33 while (true) {
wehner334 1:6e80ddd10594 34 measuereandsend();
wehner334 1:6e80ddd10594 35
wehner334 1:6e80ddd10594 36
wehner334 0:b676db63060d 37 // Do other things...
wehner334 0:b676db63060d 38 }
wehner334 0:b676db63060d 39 }