Placing a delay within any built-in function pertaining to the wireless radio will only halt operations on the Wi-Fi core or core0. Your main loop code wont be affected by a delay placed in core0. It will only halt wireless operations.

I ran into a similar issue and it took a while for me to put it together. I use global variables when passing info between core0 and core1.

  • Wireless runs on core0 and
  • Your main code runs on core1 (unless otherwise specified in the setup).
Answer from Rob Moore on Stack Exchange
🌐
ESP32 Forum
esp32.com › board index › english forum › discussion forum › esp32 arduino
vTaskDelay() vS. Delay() - ESP32 Forum
Delay is an arduino function wrapper that calls vtaskdelay. You should use it if you are using arduino, and also you should post in the arduino forum. https://esp32.com/viewtopic.php?f=2&t=2377 A tick is what you configure it to be.
🌐
Arduino Forum
forum.arduino.cc › projects › programming
ESP32-core in which file is delay() declared? - Programming - Arduino Forum
May 14, 2023 - Hi Everybody, I'm interested in the ESP32-core what are the lines of code for function delay() inside the core for ESP32 So I tried a find-text in files search in the path C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32 but with no success. As the function delay() can be used in ESP32-code it must be defined / declared somewhere How would you start searching for it? extension filter *.cpp? what folder-paths? is this so special that it is just a precompiled hex-file whcih means I c...
Discussions

Delay function not working with ESP32 - Arduino Stack Exchange
For whatever reason the delay function is not working (it is not delaying at all) with my ESP32 development board. Has anyone come across a similar issue before? It's not working with other sketche... More on arduino.stackexchange.com
🌐 arduino.stackexchange.com
May 10, 2021
ESP32 delay() doesn't work
Hi all, I am using ESP32 to do a project by using delay() function. It seems to me that the delay() function never works! I tried using the millis() as well and it doesn't work so well neither. unsigned long ini= 0 ; … More on forum.arduino.cc
🌐 forum.arduino.cc
3
0
November 18, 2022
Use timer with callback or just use a delay loop?
Don't overthink. Ask yourself that is wrong with current solution and what benefits new one will bring. ESP Timer is useful if need precise timing with high resolution or planning to sleep. Otherwise it's just additional complexity. More on reddit.com
🌐 r/esp32
10
4
June 15, 2024
delay() function doesn't work for less than 10ms
Hardware: Board: Lolin32 Core Installation version: d5fdd71 IDE name: IDF component Flash Frequency: 40Mhz PSRAM enabled: no Upload Speed: 115200 Computer OS: Windows 8.1 Description: delay() doesn't work for periods smaller than one tic... More on github.com
🌐 github.com
15
July 11, 2019
🌐
Esp32developer
esp32developer.com › programming-in-c-c › delays › delays
Delays – ESP32 Developer
ESP32 Developer · /Programming in C/C++ / Delays / Programming in C/C++ / Timing / Delays · #include "freertos/FreeRTOS.h" #include "freertos/task.h" vTaskDelay(2000 / portTICK_PERIOD_MS); The RTOS tick period is (by default) 10ms · N.B. vTaskDelay is no good for small mS delays.
🌐
RNT Lab
rntlab.com › question › esp32-replacement-for-arduino-delay
ESP32 replacement for Arduino "delay()" ??
As Steve mentioned, you can use millis(). You can also try to use taskScheduler: https://github.com/arkhipenko/TaskScheduler that uses the milis() function on the background. Regards, Sara ... Hi Sara, First MANY Thanks to you and to Rui for the incredible effort you have put into making Arduino and ESP32 understandable and fun for so many people!
🌐
Mechatronics LAB
mechatronicslab.net › home › lessons › esp32 arduino programming handbook › chapter 12: timers, delays & interrupts › delay() function for esp32 arduino programming
Delay() Function for ESP32 Arduino Programming - Mechatronics LAB
What Is delay() and Why Use It? The delay() function tells your ESP32 to “wait” before running the next line of code. One millisecond equals one-thousandth of a second. For example, delay(1000) makes the ESP32 pause for one second.
🌐
ESP32 ESP-IDF
esp32tutorials.com › home › esp32 esp-idf freertos timer and delay using esp-idf
ESP32 ESP-IDF FreeRTOS Timer and Delay using ESP-IDF
August 15, 2022 - To generate a delay, we will use “vTaskDelay.” It takes in a parameter of type integer (uint32) which is the constant TickType depicting the ticks to delay. This number corresponds to the tick which is the frequency of the chip.
Find elsewhere
🌐
Espressif
docs.espressif.com › projects › esp-idf › en › stable › esp32s2 › api-reference › system › esp_timer.html
ESP Timer (High Resolution Timer) - ESP32-S2 - — ESP-IDF Programming Guide v6.0.1 documentation
The ESP Timer feature allows for creating software timers and invoking their callback functions (dispatching callbacks) on timeout. ESP Timer is useful when user software needs to perform delayed or periodic actions, such as delayed device start/stop or periodic sampling of sensor data.
🌐
Arduino Forum
forum.arduino.cc › projects › programming
ESP32 delay() doesn't work - Programming - Arduino Forum
November 18, 2022 - Hi all, I am using ESP32 to do a project by using delay() function. It seems to me that the delay() function never works! I tried using the millis() as well and it doesn't work so well neither. unsigned long ini= 0 ; void setup() { Serial.begin(115200); delay(10); wifisecure.setInsecure(); while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); // Connect to WPA/WPA2 network.
🌐
GitHub
github.com › espressif › arduino-esp32 › issues › 2981
delay() function doesn't work for less than 10ms · Issue #2981 · espressif/arduino-esp32
July 11, 2019 - Current code is: void delay(uint32_t ms) { vTaskDelay(ms / portTICK_PERIOD_MS); } // My suggestion is: void delay(uint32_t ms) { uint32_t delay_end = millis() + ms; vTaskDelay(ms / portTICK_PERIOD_MS); while (delay_end > millis()) { NOP(); } }
Author   espressif
🌐
ESP32.io
esp32io.com › tutorials › esp32-led-blink-without-delay
ESP32 - LED - Blink Without Delay | ESP32 Tutorial
One of the first program that beginners run is to blink an LED. The simplest way to blink an LED is to use the delay() function. This function blocks ESP32 from doing other things. It will be ok if you just want to blink only a single LED.
🌐
Espressif
docs.espressif.com › projects › esp-idf › en › v4.3 › esp32 › api-reference › system › freertos.html
FreeRTOS - ESP32 - — ESP-IDF Programming Guide v4.3 documentation
See vTaskDelayUntil() for an alternative API function designed to facilitate fixed frequency execution. It does this by specifying an absolute time (rather than a relative time) at which the calling task should unblock. ... void vTaskFunction( void * pvParameters ) { // Block for 500ms. const TickType_t xDelay = 500 / portTICK_PERIOD_MS; for( ;; ) { // Simply toggle the LED every 500ms, blocking between each toggle. vToggleLED(); vTaskDelay( xDelay ); } } ... Delay a task until a specified time.
🌐
Mechatronics LAB
mechatronicslab.net › home › lessons › esp32 arduino programming handbook › chapter 12: timers, delays & interrupts › non-blocking delays with millis() for esp32 arduino programming
Non-Blocking Delays with millis() for ESP32 Arduino Programming - Mechatronics LAB
Use Cases in Real Projects With millis(), you can blink an LED while reading sensors, update a display while checking Wi-Fi, or run multiple timed tasks at once. It’s great for real-world projects that cannot afford to “freeze” during a delay. ... It starts at zero when the ESP32 resets.
🌐
Xplore-DNA
xplore-dna.net › mod › page › view.php
Coding ESP32: delay() | DNA
February 18, 2021 - #define LED 13 //LED an digital pin 13 void setup() { pinMode(LED, OUTPUT); //Pin 13 als Ausgang konfigurieren } void loop() { digitalWrite(LED, HIGH); //Schaltet pin 13 auf HIGH //(LED wird angeschaltet) delay(1000); //Das Programm wird fuer 1000 ms angehalten digitalWrite(LED, LOW); //Die LED wird ausgeschaltet(auf LOW gestellt) }
🌐
ESP32 Forum
esp32.com › viewtopic.php
Nanosecond delay - ESP32 Forum
April 12, 2024 - For less time-sensitive delays I used "busy_wait_us", but the best I found for ESP is "esp_rom_delay_us" which is marked as "Internal and Unstable". Of course, if I can manage to make a delay in 10s on ns, then this won't be a problem either. For short delays, you can use esp_rom_delay_us().
🌐
TechOverflow
techoverflow.net › 2020 › 04 › 09 › esp-idf-equivalent-to-arduino-delay
ESP-IDF equivalent to Arduino delay() | TechOverflow
May 6, 2026 - You can use the FreeRTOS API to provide a delay similar to the Arduino delay() function in the ESP-IDF framework. FreeRTOS is included in the PlatformIO ESP-IDF default configuration. ... After that, you can use vTaskDelay(...) to perform the delay. This example delays by 500ms: ... You can use vTaskDelay() even if not using FreeRTOS tasks. For a full example, refer to PlatformIO ESP-IDF ESP32 blink example
🌐
PlatformIO Community
community.platformio.org › platformio core
How to delay microseconds on ESP32 under a Free RTOS task - PlatformIO Core - PlatformIO Community
September 8, 2022 - I have some code running as a FreeRTOS task on my ESP32. I would like to toggle an output pin in the order of microseconds so use the function delayMicroseconds. However, this crashes my ESP32 every time. Even a simple loop causes it to crash: for ( int i = 0 ; i