Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HR Monitoring Help

ANSWERED

Looking for a little help in finding the best way to monitor HR.

 

Essentially the end result that I am looking for is if the HR is below a defined number, to run a function.

 

Using an IF statement works, but it only works, but only triggers a single time.

function lowHRDetect() {
let lowHR = (hrm.heartRate);
if (lowHR <= 76) {
doSomething();
}

 

Using a DO/While statement sends the app into a tizzy and a boot loop.

let lowHR = (hrm.heartRate);

do {

lowHRDetect();

while (lowHR <= 76);

 

I have tried to get creative and setting up a loop to re-run the function using setTimeout but that sends it into another boot loop.

 

What is the best practice to trigger the function and then reset it so that it can be used over and over?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

I think this example might give you a good idea how to do it.

https://github.com/Fitbit/sdk-moment

 

View best answer in original post

Best Answer
0 Votes
1 REPLY 1

I think this example might give you a good idea how to do it.

https://github.com/Fitbit/sdk-moment

 

Best Answer
0 Votes