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

Off Wrist Heart Rate Versa

I'm using what seems to be the standard heart rate code -

hrm.onreading = function() {
if (hrm.timestamp === lastReading) {
myPulse.text = "--";
}
else{
myPulse.text = hrm.heartRate;
}
lastReading = hrm.timestamp;
hrm.stop();
}

On a Versa when the watch is off wrist I would expect the return to be "--" but it looks stuck on the last reading.

Best Answer
0 Votes
1 REPLY 1

Assuming you called hrm.start() after defining the onreading event handler, I think you just need to move your hrm.stop() call to an unload event handler, something like this:

 

me.onunload = () => {
saveValues();
hrm.stop();
console.log("We're about to exit");
}

 

John

Best Answer