multi tasking issue

Hello,

I'm new to arduino. What's the best way to achieve multi tasking?

Right now I have two arduinos linked together using newsoftserial on a digital pin and the main loop can't have a delay otherwise either arduino won't receive the string sent. However I have some functions in the main loops that require a delay.

What's the best way to solve this issue?

Start here: http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

This forum really needs a FAQ. This item would be high on the list.

Hello,

I've read the faq and I'm aware of that method however it doesn't solve my particular issue, so perhaps I should have been more clearer.

The functions inside my loop require an actual delay before the next command so I can't use that method in the faq. Ideally I'd like to have 2 main loops, one for listening on the newsoftserial rx pin without any delays, another for communicating with peripherals on other pins and then send data on the tx pin with required delays between command.

So to rephrase my original question, is there any other methods of achieving multi tasking beside the blinking method in the faq? I find it hard to believe that arduino is restricted to just one main loop, running multiple loops I think is somewhat logical but I can't find any info on that.

I am also new to this but I believe it is a limitation of the micro-controller not arduino as such.

So I would say you are asking for some way to make it do something it is incapable of doing.

Psuedo multi (and certainly dual) tasking is not that difficult if you have access to an appropriate interrupt, say from a timer. There must be a library or tute to do this by now.

I've got a monitor running as a background task on an Arduino, the principal is the same and it's not rocket science.

NSS is interrupt-driven isn't it? Does it set a global flag to say there is data available? If so that's half way to being dual tasking I would think.


Rob

NSS is interrupt-driven isn't it? Does it set a global flag to say there is data available? If so that's half way to being dual tasking I would think.

Yes and yes.

I find it hard to believe that arduino is restricted to just one main loop,

I find it hard to believe that you find that hard to believe.