I am working on a school project where I need it to do something on shake. However, it will activate with the slightest movement. Is there a way to change the shake sensitivity?
Hi @Whatsuphi — welcome to the forum!
I don’t think there’s an easy way to update the sensitivity.
Here’s a kind of complicated way that would require some variables. The basic logic used for shake detection (for microbit v2) can be found here. You could create your own logic that uses the same basic approach, but uses higher thresholds. I think there are a few different concepts being used:
- Detecting the back-and-forth between high accelerations (zero crossing or threshold crossing) in each direction.
- Counting the number of zero crossings to see if they are enough to consider it a valid “shake”.
- Checking if enough time has passed to either: start detecting another shake (if there was one in the past) or to start “forgetting” peaks if it’s been too long since the last one.