Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By mrburnette
#70591 I would just utilize delay (0) which is functionally equivalent to yield ()
Unless the 10mS delay is actually required,

For example, the 1mS is necessary in the code below:

/* Initializations */
// ------------------begin ESP8266'centric----------------------------------
WiFi.forceSleepBegin(); // turn off ESP8266 RF
delay(1); // give RF section time to shutdown
system_update_cpu_freq(FREQUENCY);
// ------------------end ESP8266'centric------------------------------------


I have a few other ESP8266 projects over on my page:
https://www.hackster.io/rayburne/projects


Ray
User avatar
By mrburnette
#70615
andre_teprom wrote:Whenever possible, use delays based on interrup timer rather than closed loop "delay(value)" implementations.


No.
The entire purpose of yield () or delay (0) is to provide a release of the Arduino thread so that non-OS can have some cpu time. There is no benefit in this case of interrupt-timed pauses.

Ray
User avatar
By andre_teprom
#70621
mrburnette wrote:No.
The entire purpose of yield () or delay (0) is to provide a release of the Arduino thread so that non-OS can have some cpu time. There is no benefit in this case of interrupt-timed pauses.


I wonder how one could implement a longest delay by using the suggested structure with argument 0.
Interrupt-based delay is allways the better choice, since this way can use a time slot to split the tasks into specific time alocation.