Flashing 2 LEDS independent timing when button is pressed

you might benefit from studying state machines. Here is a small introduction to the topic: Yet another Finite State Machine introduction

the state machine would look something like this

I'd suggest you use a button library such as Button in easyRun or OneButton or Toggle or EasyButton or Bounce2 to handle the button press.

2 Likes