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

01-10-2018 10:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
When using the provided tutorial code for the HR meter it's failing to pull back heart rate values. Below is a snippet of the code. When I switch it to pull it directly with setinterval() I see the value is showing null. I've restarted my watch, turned the heart rate monitor on and off and still nothing. I'm also able to read values from the other sensors so this is just an issue with the HR monitor which is the main sensor I need. Your assistance is greatly appreciated.
/ Create a new instance of the HeartRateSensor object
var hrm = new HeartRateSensor();
// Declare a even handler that will be called every time a new HR value is received.
hrm.onreading = function() {
// Peek the current sensor values
console.log("Current heart rate: " + hrm.heartRate);
hrLabel.text = hrm.heartRate;
lastValueTimestamp = Date.now();
}
// Begin monitoring the sensor
hrm.start();
// And update the display every .5s
setInterval(updateDisplay, 500);
Answered! Go to the Best Answer.

Accepted Solutions
01-10-2018 10:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-10-2018 10:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Check that you've granted permission to the heart rate sensor in the package.json

01-10-2018 10:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-10-2018 10:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Check that you've granted permission to the heart rate sensor in the package.json

01-10-2018 10:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-10-2018 10:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
TY so much that was the key.

