How can I calculate time the pin is rising using interrupt?

I want to calculate rising time when I press the button. I declared external interrupt to the button.

int signal_detect = 2; //21. pin rölede(CSQ detect kullanıldı
volatile unsigned long first_time=0;
volatile bool control = false;

void setup() {

  
 Serial.begin(9600);
 attachInterrupt(digitalPinToInterrupt(2), interrupt_button, RISING);

}

void loop() {
 
  if(control == true){
     Serial.println(first_time);
  }

  else{
     Serial.println("Konuşma bekleniyor");
      Serial.println(first_time);
  }
 
  
  
}

void interrupt_button(){
 control=true;
  first_time = millis();
   
}

When the second pin is not rising , the control variable not changing.

Yes I want return back false value.

Maybe just add control = FALSE after
Serial.println(first_time);

I don’t see how this is doing to calculate any time through..

In fact are you literally trying to calculate how long it takes from the time you press the button to the time the Arduino detects the pin went from low to high and set the interrupt flag?

Or you literally just want a “log” of what milliseconds the Arduino was at when it detected the change?

How is it wired to the button? I see no evidence of any pullup or pulldown.

I see you have made a good attempt to tell us what you want it to do and what it actually does. But I do not understand what you want it to do. Perhaps this is a translation problem? Please try again, using more sentences or try a support forum in your native language.

heysen:
I want to calculate rising time when I press the button. I declared external interrupt to the button.

Sorry, but that does not make sense.

In an Arduino is either LOW or HIGH. If you set an interrupt as RISING it will only trigger AFTER the pin has become HIGH. And normally the transition time will be measurable in nano-seconds - if you had a suitable oscilloscope.

...R