05-01-2018 16:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-01-2018 16:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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?
Answered! Go to the Best Answer.

Accepted Solutions
05-01-2018 23:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-01-2018 23:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-01-2018 23:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-01-2018 23:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

