Created
September 6, 2022 14:52
-
-
Save splch/f5d3856c450fcd5d6bd84735b2d14c25 to your computer and use it in GitHub Desktop.
detect if a bangle watch is being worn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isWorn() { | |
console.log(Bangle.isCharging(), E.getTemperature(), Bangle.getAccel().mag); | |
if (Bangle.isCharging()) | |
return false; | |
if (E.getTemperature() >= 33.1) | |
// https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8266026/table/T2/ | |
return true; | |
if (Bangle.getAccel().mag >= 1.02) | |
return true; | |
return false; | |
} | |
console.log(isWorn()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment