Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 // Author: kasturir@ucla.edu (Kasturi Rangan Raghavan) 00002 // \file 00003 // QRSDet library for QRS delays 00004 // Very naive and basic implementation to demonstrate 00005 // QRS code ported from QRSDet. 00006 // 00007 // Note: 00008 // Change both the wait_us and qrsdet::SAMPLE_RATE (in qrsdet-params.h) 00009 // to adjust to different sampling rates. Currently set up for 125Hz 00010 // Also, the offset/scale for reading ADC input may have to be adjusted 00011 // 00012 // Note2: 00013 // Since function are not pure, local variables stored as static, 00014 // That means the filter functions like deriv1, etc should be left alone. 00015 00016 #include "mbed.h" 00017 #include "qrsdet2-inl.h" 00018 #include "qrsfilt-inl.h" 00019 00020 DigitalOut peak(LED1); 00021 DigitalOut time_out(LED4); 00022 DigitalOut time_out1(p18); 00023 PwmOut bridge_out(LED2); 00024 00025 AnalogIn ecg_in(p20); 00026 float float_val; 00027 int int_val; 00028 int delay; // return of QRSDet 00029 int main() { 00030 time_out = 1; 00031 //qrsdet::QRSDet(0, 1); 00032 qrsdet::deriv1(0, 1); 00033 peak = 1; 00034 while(1) { 00035 float_val = ecg_in.read(); 00036 int_val = float_val*128; 00037 delay = qrsdet::QRSDet(int_val, 0); 00038 if ( delay > 0) { 00039 peak = !peak; 00040 } 00041 wait_us(8000); // 125Hz 00042 bridge_out = float_val; 00043 time_out = !time_out; 00044 time_out1 = !time_out1; 00045 } 00046 }
Generated on Sat Jul 23 2022 09:25:30 by
1.7.2