I want to trigger a buzzer using arduino when 6 volts 154 hz drops to 0 hz. Wondering what's the best way to do this. I have already accomplished this using a 555 missing pulse detector, but I really want to use arduino so I can do more customization.
6 volts 154 hz drops to 0 hz.
You can't do that because you have to wait an infinite time before you know it is 0Hz.
I have already accomplished this using a 555 missing pulse detector
So you write the arduino code as if it were a missing pulse detector. That is use a variable to get the millis() timer when you see the high of a pulse. Then keep looking at the timer to see if the current value minus the recorded value is greater than your threshold value. When it is your frequency has dropped.
Alternatively use the pulse in function and put a timeout value on it.
Note that in order to perform these timing comparisons in non-blocking code ("pulseIn()" is blocking - you can do absolutely nothing else while it is waiting for the pulse), you need to perform two steps in your loop - polling for the change of your input, and polling for a time (millis()) which constitutes the timeout of your "missing pulse".
The point of non-blocking code is that you generally want to continue to do other things while you wait on your specified event, whether those other things include flashing LEDs, anticipating keyboard (or serial) input, or monitoring more than one input for missing pulses. To do this, you construct your loop as a series of steps each of which makes an instantaneous decision and then passes on to the following step so that the whole loop continues to cycle through all steps rapidly, generally within a millisecond or so for each pass.
Thanks for the help, I'll give it a try.