if structure takes too much time

PaulS:
How does knowing the temperature relate to security? What does "the function is not achieved" mean?

This system is designed to manage quite high power and it will be in a small box. I am a little bit anxious about the rising température.
That's why i added a thermal sensor, it will shut down the system if the temperature goes too high.
Just for information, it will manage 25 Watts.

I comment all my serial prints, the 200 millis delay and it's the same

To give you a better idea, if i turn this statement for a very short time:

 else if (digitalRead(PharesDetresse) == HIGH)
 {
  analogWrite(LEDpin, 255);
  delay (100);
  analogWrite(LEDpin, 25);
  delay (800);
 }

it blinks approx 10 times after the input LOW

Normally it should stop immediately after the input LOW...