Heart Rate calculation using Pan-Tompkins library on NRF52840

Hello !!

I'm struggling with heart beat counting using Pan-Tompkins library on Github with my NRF52840 board.

I followed the instruction of the author of the Github code but still can not implement the function int16_t PT_get_LongTimeHR_output(int16_t Fs) in my code, the output of this function always is 60 and didn't vary at all, i don't know what is the problem?

this is how i did:

PT_StateMachine((int16_t)  sample);  //sample is the raw ECG input

data[ i ] = PT_get_LongTimeHR_output(200);   //200Hz is the sampling frequency as suggested in the Github code

NRF_LOG_RAW_INFO("%d \r\n", data[ i ]); 

this always outputs as 60 BPM which is obviously wrong in my case, how can i fix that? 

Related