Hi,
I'm trying to improve my watch-face, however I'm not receiving any heartRate readings? This exported function is imported inside another file and then being called. Any help would be great!
import { HeartRateSensor } from "heart-rate";
import document from 'document';
// Initialises the heart rate.
export default function outputHeartRate() {
const hrm = new HeartRateSensor({ frequency: 1 });
const heartEl = document.getElementById('heart');
hrm.addEventListener("reading", () => {
console.log(`Current heart rate: ${hrm.heartRate}`);
heartEl.text = hrm.heartRate;
});
hrm.start();
}
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Looks ok.
Did you request the access_heart_rate permission?
Best AnswerI've requested the heart rate permission via the package.json, I've got it working by moving the instantiating of the HeartRateSensor outside of the exported function. Do you know why that would make it work? Thanks!
Best Answer