SW-420 Vibration Sensor

Hello All,
Relatively new to arduino. Done a few school projects, but not too much on my own that I couldn't hunt down code on the internet for until now.

Here is the basic idea:

I am a private pilot and I use a device called a stratus that pulls in various information such as air traffic, weather, etc. Mine suction cups on to the rear window of the aircraft. Anyway, they are notorious for being left behind in the aircraft, never to be seen again which is quite a shame given the rather hefty price tag. I bought an arduino nano and an SW-420 vibration detector and some piezo buzzers. The idea was to activate the device, then have it wait until the vibration of the engine stopped (ie, you arrived and shut down the aircraft) at which point it would beep at you. I have managed to get it to beep when vibration is detected no problem, but for what I believe is a data-smoothing issue, I can't get it to work the other way around and be quiet when there is no vibration and to beep when there is. Basically, I can't get it to shut up when there is vibration. I have played with the potentiometer a good bit and nothing I do seems to work. It must be somewhere in my code. Any ideas?

(here is a link to a page that shows how to set up the device as well as some basic code for it)

Thank you for any help you may be able to provide!

Edit: I believe the issue lies in the fact that vibration is a wave, and thus the sensor gets some false negatives when there is vibration when the wave is at its peaks and troughs. This would be reinforced by the flickering of the light on the sensor. If I could take a sample of say 10 vibrations, then average them together. If the average is less than a certain value, then beep. If it is above a certain value, say 0.5, then don't beep. I just am not familiar with the code as I once was and can't really seem to get this to work.

One approach is to count shake switch closure events over a period of time, say one minute, and if that drops to zero or some small threshold, buzz.

Record the start time using millis(), then check if the time period has elapsed before checking counts. Something like:

unsigned long count_time=60000UL; //60 seconds
unsigned long thresh = ??;
unsigned long start = millis();
unsigned long count = 0;
while (millis() - start <= count_time) {
   if (read_switch()) count++;  //increment count if switch closed
if (count < thresh) buzz();

The above assumes that the function read_switch returns true or a non-zero number if the switch is closed.

Ok. Let me give this a try. Will post an update...