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
Diff: main.cpp
- Revision:
- 0:b676db63060d
- Child:
- 1:6e80ddd10594
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 03 21:39:44 2015 +0000 @@ -0,0 +1,30 @@ +#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... + } +} \ No newline at end of file