Multitasking? Continuously transmitting data and making network connections

Is it possible to write multitask code in Arduino? I think not but I wanted ask anyway. My aim is to continuously transmit data over RF while checking for data every 10 seconds over WIFI using ESP8266.

How should I code my program? In loop() code, I’m considering using a for loop like the one below:

for (int i = 0; i < 10; i++) {
      if(i==0) {
        sendWIFIcode();
      }
      sendMessageToReceiver();
 }

well there is only 1 core and some hardware units to handle specific tasks. so multi-tasking is really just task scheduling to ensure none of your critical tasks starve. as this is not managed at "OS level" the OS is very minimal it means you have to do it yourself.

For time critical segments, interrupts can be useful, for other it's about maintaining good programing practices. Don't stop the processor, give a chance to another task to work if what you need to do is not critical etc...

there has been many attempts to develop some libraries for thread management or arduino-multi-threading and more. you still need to worry about overall memory management which is of course the second constraint.

I never really used it beyond high level intellectual curiosity and preferred to manage time at a lower level of granularity when necessary.

Demonstration code for several things at the same time

You can find similar topics everywhere on the web