Skip to content

Instantly share code, notes, and snippets.

@splch
Created September 6, 2022 14:52
Show Gist options
  • Save splch/f5d3856c450fcd5d6bd84735b2d14c25 to your computer and use it in GitHub Desktop.
Save splch/f5d3856c450fcd5d6bd84735b2d14c25 to your computer and use it in GitHub Desktop.
detect if a bangle watch is being worn
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