If the OnKeyPress event (function) is before the hrm event, the hrm output fails.
If I turn the order around, the hrm event will work but the OnKeypress event fails.
Only by switching the order in the code (It doesn't matter what happens within the functions).
document.onkeypress = function(e) {
switch(e.key)
{
case "up":
(config) ? setServe(sides.SIDE_A) : setScore(sides.SIDE_A);
break;
case "down":
(config) ? setServe(sides.SIDE_B) : setScore(sides.SIDE_B);
break;
case "back":
hrm.stop();
break;
}
(debugLevel >= levels.LOW) && console.log(e.Key);
}
var hrm = new HeartRateSensor();
var txtHeartRate = document.getElementById("heartrate");
hrm.onreading = function() {
txtHeartRate.innerText = hrm.heartRate;
(debugLevel >= levels.HIGH) && console.log(hrm.heartRate);
hrm.stop();
}
Best Answer
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.
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.
Can you put the project on Github? Thanks
Best Answer