Is multitasking possible?

Hello,

I was just wondering if it is possible to multitask on the Arduino and if so, how?

Yes. Depending on what you want to do, the best method will be different.

Search for Tiny RTOS. That's one method that's overkill for most Arduino projects.

If you write a nice tight loop that handles things in small chuncks and doesn't block anywhere, it is possible to make it look like multitasking is going on. But the Arduino can only run one instruction at a time. There's only one processor there. So true multi-threading is not a possibility.

I've heard that you can use millis() so that it looks like it's multitasking. How do you do it?

Gammon explains blink without delay

Look at the demo several things at a time

This type of multitasking has little in common with the systems used in the Linux and Windows operating systems.

...R

Google "cooperative multitasking"

It's something that women claim to do, to make guys feel inferior. In reality, they just blink without delay. It works for me :wink:

KenF:
In reality, they just blink without delay.

Don't get taken in by fluttering eye-lids :slight_smile:

...R