Hi,

Cant you use an interupt that will start a timer when the circuit opens.. and then you use an interups to stop the timer when the circuit closes and reload timer.

Then you set up the timer to overflow at a suitable time. If the box is tilted the timer will overflow and give you a timer interupt. If the box is just shaked the time between sensor toggle is so small so you will not get an overflow.

maybe ;-)