Help in monitor frequency to change output LED

This is my first Arduino project (outside of the basic turning LED's ON/OFF). Is what I want to do is monitor an analog signal (0-5VDC) and see if it is pulsing or not. If it is pulsing then everything is working correctly and the LED should be off. If it is constant HIGH or LOW then that signals an issue and I want the LED to turn ON and stay on until the pulse resumes.

I'm not savy enough to get into using tables/charts/Array's yet and I was wondering if someone could help me flesh out the following statement into something the Arduino can process. I know my way of thinking and taking a statement I understand and converting it will help me understand this much more.

If Analog1 is = or < 2 hz for 3 seconds then change Digital1 to HIGH.

Else Digital1 LOW

I attached a rough schematic of the circuit and conditions of the inputs/outputs.

Thank you guys very much for taking the time to look at this :).

Planter Schematic.pdf (1.05 MB)

Once in a while, it happens that I'm first with the news :

Make some code and place it within these tags !

That will make it so much easier to help you on with your prject.

I did try to make some code but was afraid I'd butcher it way too much for anyone to understand.

I'm hoping there's a nice person out there there that can flesh out my statement and help me understand what it actually needs to look like.

Think of it this way:
start a 3 second timer.
count the number of times your input pin changes.
If, within 3 seconds, your input hasn't changed 13 or more times (6 up and 7 down, or vice versa) then light your LED/sound the alarm/PANIC! :slight_smile:
else restart your timer, etc.

Demonstration code for several things at the same time - Project Guidance - Arduino Forum will show you how to use timers

BTW, don't use digital pins 0 & 1 as they may interfere with uploading your sketch.