Help with button / LED code

Hello,

I would like to use a momentary button as an input and an LED as an output. When the button is pressed, the LED is on. When the button is not pressed, the LED is off.

If the button is pressed for approximately 1 second then released for approximately 1 second, three times in a row, then the LED stays on for one minute. If the button is pressed for any amount of time during the 1 minute, the LED turns off and acts as it did in the first sentence.

If anyone can help me with this code or point me to some examples of similar code, I'd really appreciate it.

Thanks.

Could you please post the source code? and which pin did you use?

When the button is pressed, the LED is on. When the button is not pressed, the LED is off.

This part is trivial, if the LED and switch are wired correctly.

If the button is pressed for approximately 1 second then released for approximately 1 second, three times in a row, then the LED stays on for one minute.

This part requires that you detect transitions (switch is now pressed but was not last time or switch is not pressed now but was last time) and to record when the transitions occur (millis()), and to count how many transitions have occurred. Not terribly difficult.

f the button is pressed for any amount of time during the 1 minute, the LED turns off and acts as it did in the first sentence.

This is pretty simple, to. You need a state machine. Press on, release off is one state. Press and hold three times is another state. Press and release while in the three state causes and immediate transition. Press and release in the one state does not.