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