Yes, I'm afraid it's an almost impossible problem with only the accelerometer... A Gyro would help no end but the Bangle doesn't have one (Puck.js does).
But, one hack that might help you is you say that when you're not accelerating, gravity should be 1, and the accelerometer will be pointing towards the earth. So when that happens you know kind-of where you are. For example:
var Vec3 = require("Vec3");
var G = new Vec3();
Bangle.on('accel',a=>{
if (a.mag>0.98 && a.mag<1.02) {
G = new Vec3(a);
} else {
var diff = G.sub(a);
print(diff);
}
});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, I'm afraid it's an almost impossible problem with only the accelerometer... A Gyro would help no end but the Bangle doesn't have one (Puck.js does).
But, one hack that might help you is you say that when you're not accelerating, gravity should be 1, and the accelerometer will be pointing towards the earth. So when that happens you know kind-of where you are. For example: