Button with dual function

First time creator here. I have done several example projects and now looking to do my own project.

Here is what I want to do.

Have 2 momentary buttons that upon pressing one, it makes a led flash and trigger a relay for 1s and then stop. (Two different led/relay sets one for each button)

But if the user pushes the button several times in a row up to a max of 10 times within 2s time frame I want each press to be counted and then for each press make the led flash and relay switch for 1500ms
(Example:9 presses would make it last for 13500ms)

Then if the button is pressed during the time running I want it to stop the led flashing and triggering of the relay, and light a different led for 1500ms. (Basically a cancel button but using the same button)

How hard will this be, and can you point me in the correct direction.

Follow up question: I have a duo card that it will be using for testing. Once its running correctly, can I transfer this to a arduino nano for the final project?

almulder:
First time creator here. I have done several example projects and now looking to do my own project.

Here is what I want to do.

Have 2 momentary buttons that upon pressing one, it makes a led flash and trigger a relay for 1s and then stop. (Two different led/relay sets one for each button)

But if the user pushes the button several times in a row up to a max of 10 times within 2s time frame I want each press to be counted and then for each press make the led flash and relay switch for 1500ms
(Example:9 presses would make it last for 13500ms)

Then if the button is pressed during the time running I want it to stop the led flashing and triggering of the relay, and light a different led for 1500ms. (Basically a cancel button but using the same button)

How hard will this be, and can you point me in the correct direction.

Follow up question: I have a duo card that it will be using for testing. Once its running correctly, can I transfer this to a arduino nano for the final project?

Very easy to do.

But first you have to master 'Basics and Digital' examples that comes with the IDE.

If you write it, it will work on the Nano

Here is what I have so far. Where do I go from here?

const int button1Pin = 3;  // pushbutton 1 pin
const int relay1Pin = 2;      // This pin drives the transistor (which drives the relay)
const int timeDelay1 = 1500; // delay in ms for on and off phases
const int led1Pin =  13;    // LED pin
const int led2Pin =  12;    // LED pin

int led1State = HIGH; 
int led2State = LOW; 
int button1State;


void setup() {
  pinMode(button1Pin, INPUT);
  pinMode(led1Pin, OUTPUT);
  pinMode(led2Pin, OUTPUT);
  pinMode(relay1Pin, OUTPUT); 

  digitalWrite(led1Pin, led1State);
  digitalWrite(led2Pin, led2State);
}


void loop() {
  int reading = digitalRead(button1Pin);
  button1State = digitalRead(button1Pin);
  
  if (button1State == LOW)
    {
       digitalWrite(led1Pin, LOW);  // turn the LED off
       digitalWrite(led2Pin, HIGH);  // turn the LED on
       digitalWrite(relay1Pin, HIGH);  // turn the relay on
       delay(timeDelay1);
    }
     else
    {
      digitalWrite(led1Pin, HIGH);  // turn the LED on
      digitalWrite(led2Pin, LOW);  // turn the LED off
      digitalWrite(relay1Pin, LOW);   // turn the relay off
    }
}
/[code]