10-14-2017 08:47
10-14-2017 08:47
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 Answer10-14-2017 09:42
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.
10-14-2017 09:42
Put these two lines above both events.
var hrm = new HeartRateSensor();
var txtHeartRate = document.getElementById("heartrate");
Best Answer10-14-2017 10:36
10-14-2017 10:36
Same Problem 😞
Best Answer10-18-2017 13:21
10-18-2017 13:21
Doesn't anyone have an idea?
Best Answer10-18-2017 16:10
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.
10-18-2017 16:10
Can you put the project on Github? Thanks
Best Answer