11-14-2017 18:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-14-2017 18:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I have been working on my first clock face, and one of the items I want on the face is my heart rate. I am following the examples, but it doesn't seem to work. I am sure its something i am missing because the heart rate shows up on the stock face.
Any insight will be greatly appreciated!
Here's the code (I only get the "-" on the clock face, nothing logged to console):
// start code segment
let myHRM = document.getElementById("myHRM");
myHRM.text = "-";
var hrm = new HeartRateSensor();
hrm.onreading = function() {
// Peek the current sensor values
myHRM.text = hrm.heartRate;
console.log("Current heart rate: " + hrm.heartRate);
// Stop monitoring the sensor
hrm.stop();
}
// clock displays hours mins and secs fine
clock.ontick = function(evt) {
myClock.text = (" " + (parseInt(evt.date.getHours(),10) % 12)).slice(-2) + ":" +
("0" + evt.date.getMinutes()).slice(-2);
mySecs.text = ("0" + evt.date.getSeconds()).slice(-2);
// Peek HR sensor
hrm.start();
}
Answered! Go to the Best Answer.

Accepted Solutions
11-14-2017 18:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-14-2017 18:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Newbie error. I figured out shortly after posting that Heart Rate needed to be enabled in Package.json.
Problem solved.
11-14-2017 18:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-14-2017 18:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Newbie error. I figured out shortly after posting that Heart Rate needed to be enabled in Package.json.
Problem solved.
