haha - the commenting effort comes from my day job (C++ developer) - but if there is enough space - why not to put some comments ;)
I try out to smooth the rotations and side detection by low pass filter
// some global stuff
var alpha = 0.5;
var mySmoothValue = 0;
// low pass filter to get smooth value without high peak changes
var newValue = ... // something you want to smooth ;)
mySmoothValue = newValue * alpha + (mySmoothValue * (1.0 - alpha));
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.
haha - the commenting effort comes from my day job (C++ developer) - but if there is enough space - why not to put some comments ;)
I try out to smooth the rotations and side detection by low pass filter