Debounce Logic for the tilt switch