Help producing some code!

So I’ve been staring at this all day, and I just cant wrap my head around how to do what I want fully; so here it goes:
I’m trying to create a alarm function if you will, that when a global variable goes passed a certain threshold then I need it to analog write a PWM value to some LED’s and then off, trying to go for a strobe rate of 7 Hz; and then if the value does go back below within the allotted time of say 2 seconds then PWM write the LED’s off. Else if the global variable persist past the threshold for longer than 30 seconds then digital write a pin on and off at a rate of say 3 Hz. Continue this whole operation for 1 minute; then take a rest for 5 minutes; then go back and check again from the top. All of this must use timers and no delays as well because I have serial communication going on in the loop as well that can’t be missed. Please please help me out here, I know there are some code guru’s here! I don’t want you to write it all for me, but please give me some direction here! :slight_smile:

Thank you! :smiley:

start with blink without delay.

that will give you the information needed on how to set and adjust timers.

after that, it seems like straight forward IF statements with timers would be needed.

nice fair last week in maaskantje.

So make a digarm of what you want.

i will give you a start

case casenumber
if analogvalue > setpoint){casenumber=2}
pwmoutput= 10

it is now 23:11 and going to bed.