loops in arduino

is it possible to have more than one loop running at a time in arduino?

I have tried various methods and none seem to work. I would like to have one loop adding values to an integer with a delay of 50 for instance, and then another loop monitoring pushbutton states with a delay of 10. If I go longer than a delay of 10 I seem to have delay in the function occuring I am trying to control with the pushbuttons.

Thanks for any help

You might want to look at the BlinkWithoutDelay example:

That's the "simple" method (good for probably most tasks); there are much more complex possibilities, up to and including some of the embeded "OS" sketches that can be loaded...

:slight_smile:

For monitoring pushbuttons you can use interrupts.

Mowcius

is it possible to have more than one loop running at a time in arduino?

No.

You need a state machine:-
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1227484674