Act on 2nd trigger in 5 seconds

Hi I have the code below I use this code within 5 seconds 2 times (trigger) command (role) I want to give output I want to do how do I help?

#define role 3
#define trigger 12

int t_durum;

void setup() {
  pinMode(role, OUTPUT);
  pinMode(trigger, INPUT);

void loop() {

  t_durum = digitalRead(trigger);


    if (t_durum == HIGH)
      digitalWrite(role, HIGH);
      digitalWrite(role, LOW);

Here are a few things to consider:

  1. It appears that HIGH is the triggered state; however, you want to see if the trigger happens 2 times within 5 seconds. Therefore you need to check for a LOW to HIGH transition on trigger.
  2. When you see a LOW to HIGH transition on trigger you need to start timing 5 seconds. You can do that using the millis() function. Here is a tutorial that might help with that. Walk Away From Delay
  3. What if you get 4 or more triggers within 5 seconds? Do you want 2 output pulses or do you want to suppress multiple outputs during the same 5 seconds?
  4. What is your trigger input connected to? If it is connected to a mechanical device (switch or relay) it will most certainly bounce which will cause 2 or more transitions with one action of the device. Also, depending on how your input operates and is wired you will likely need a pull-up or pull-down resistor.

Without the above details considered you cannot arrive at a solution. Provide these details and your attempt at a solution and I'm sure you will get additional help.