Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Electroguard
#25195 Hi. My on-going project has run out of Arduino resources, so I need to try to separate and distribute the required functionality across multiple nodes, which led me to ESP8266 initially for comms, but then to the unexpected discovery of ESPs being used to run Arduino sketches...
and now I'm stood at at a new crossroads without knowing which way to go.

I would like to be able to off-load some of the memory-hungry Arduino tasks to ESP if possible - like reading/writing to SD files, speech, IR send and receive libraries etc,- and I've seen that i2c and SPI and interupts are all possible on an ESP - but I've also seen it mentioned that the recommended duration for an ESP to be tied up in user code is less than 10ms (or else it may not be able to maintain the wifi functionality it was designed for)... so how does that affect the practical usage of Arduino sketches running on an ESP?

Does it rule out doing anything that may take longer than 10ms?, or is there perhaps some sort of interupt-driven buffering function which a sketch can be run in which passes control back to the ESP background tasks on an as-needed or timed basis and then allows the sketch to continue from where it was interupted?, or is there perhaps a housekeeping lookup function which needs to be called frequently throughout the sketch?

Basically, is it feasible for an ESP to carry out such Arduino tasks as speech, IR, SDfat access, interupt-driven port-expanders etc while still maintaining wifi functionality?, or would it be more practical to use multiple Arduinos for all such tasks and just use ESPs for linking the Arduinos together?

I would appreciate any directions from anyone who's already been there,
Thanks, Robin.
User avatar
By andrew melvin
#25214 I think that the 10ms is a big underestimate.

I've got a sketch that deals with ws2812s... runs a web server (5 pages), MQTT, DNS, EEPROM and UDP and can still bitbang out about 400 ws2812s, which takes 12ms.

Writing to the EEPROM takes 34ms and all this takes place in one loop.

If your loop is long, you can put in delay(0) or yield() which allows the wifi to run.

hope that helps

A