Timing problem with millis

Your sketch in Wokwi simulation: Timing problem with millis - Wokwi ESP32, STM32, Arduino Simulator