Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By UrsEppenberger
#70522 Hello

I do home automation with ESP8266 devices, some bought from sonoff, some homebuilt stuff based on ESP-201. I use MQTT as the communication relay between the node-red based backend and the devices.

For some applications I have the requirement that the device should always do its main tasks independently if WiFi or even MQTT are up and running. For this I wrote some code as a framework to be reused in the various devices I have. I'd like to share this code. It might be useful for someone else, but hopefully I get some feedback to improve it.

Kind regards,

Urs.
You do not have the required permissions to view the files attached to this post.
User avatar
By mrburnette
#70533 Just a reminder that user code in the section:

// start section for main tasks
// ...
// end of section for main tasts

MUST execute quickly such that the loop section as a whole runs less than 30mS *. non-OS needs to feed the native ESP8266 regularly to keep the RF section happy. Of course, you can alternately use delay() or yield() to force the non-OS task switcher to give some time to the native code task.

https://github.com/esp8266/Arduino/issues/2021
https://learn.sparkfun.com/tutorials/es ... uino-addon
https://github.com/esp8266/Arduino/issues/3042
https://github.com/esp8266/Arduino/issues/1410

Notes:
* I have seen numbers on the Internet ranging from 15mS to 50mS ... the 50mS coming from this reference:
http://esp8266.github.io/Arduino/versio ... rence.html


Ray
User avatar
By UrsEppenberger
#70589 I made an update of the code based on received comments.
I'm not a professional programmer. I do frankensteining code together, but only code I do understand. And I try to add some more thinking.

Feedback is welcome.

Kind regards,

Urs.
You do not have the required permissions to view the files attached to this post.