Hi,
I'm building a game where movement sets off an alarm. The amount of movement (i.e. sensitivity threshold) is specified at the beginning of the game.
I'm using an MPU6050 and have so far been using a loop to compare values and trigger the alarm when the threshold is crossed. It's proving difficult to stop it freezing, however, and I suspect it may be due to my Nano being overloaded.
My questions:
Would using interupts - as in the Jeff Rowberg code - be a better approach? Or is it a bad use-case?
Is the threshold for triggering the interupt adjustable? I've been searching for a long while and can't get my head around when it will be triggered, because the values have some natural fluctuation anyway. With a self-balancing robot, for example, surely the interupt is being fired constantly?
I've got hunch my conceptualisation is wrong somewhere, but would appreciate any pointers.
Many thanks,
Paul
Thanks for your reply. It was more the conceptualisation of interupts that I was looking for help with, rather than this specific issue of freezing i.e. how they are used when the data coming from a sensor has natural fluctuation.
(As an aside which may be useful for others, there does seem to be an issue with MPU6050 code and freezing that is discussed in this [long thread](http://Since my post I've been doing some more digging, and it appears there is a), with posts by Jeff Rowberg himself. From my understanding, it's not actually solvable due to certain software / hardware constraints)
pallen33:
It was more the conceptualisation of interupts that I was looking for help with,
rather than this specific issue of freezing i.e. how they are used when the data coming from a sensor has natural fluctuation.
pallen33:
(As an aside which may be useful for others, there does seem to be an issue with MPU6050 code and freezing that is discussed in this [long thread](http://Since my post I've been doing some more digging, and it appears there is a), with posts by Jeff Rowberg himself. From my understanding, it's not actually solvable due to certain software / hardware constraints)