# Can libraries be used like this?

I have been toying with arduino(s) and have come to the same problem most do...multitasking.

Is it possible to multitask using multiple libraries based on certain parameters? eg:

(nonworking code{obviously})

include infiniteLedSequence1 include infiniteledSequence2

void setup()

Void loop ()

if switch 1 == HIGH (ledSequence1) if switch 2 ==HIGH (ledSequence2)

=================== Basically it would do LED loops without being themselves in a loop. so in theory they would run together, at the same time

I understand this is very "layman" writing but i think i conveys what i want to do.

Thanks

Is it possible to multitask using multiple libraries based on certain parameters?

No.

Basically it would do LED loops without being themselves in a loop. so in theory they would run together, at the same time

Using what theory?

It's possible to blink a whole bunch of LEDs at the same time (or, near enough that you can't tell). As long as your fingers never stray near the d, e, l, a, and y keys in that order.

maybe i should be more specific...probably would help. :P

i want a series of 12 or so leads to light in ascending order then Off.

ie1: 0 00 000 0000 (until 12th lit) then repeat forever

that part is easy.

the problem is that i need 4 other led to be blinking one right after the other at the same time

ie2:

0 0 0 0

# repeat forever

so ie1 and ie2 must happen at the same time. however it seems to be eluding me...

You do not need to use multitask, led can switch very fast

Arguing Uno runs 16 million processor instructions or second :-) you merely need to figure out some clever flag checks based programming to achieve the effect you want in the loop.... and I'll bet you'll actually need to add extra delay to actually slow arduino down enough to see the effect

I'll bet you'll actually need to add extra delay to actually slow arduino down enough to see the effect

He said the "d" word.

You can do that sequence, but make it time based. Each sequenece can be based on independent times. Conceptually:

void loop(){ if (elapsed time for loop1 is met) { do the LED pattern update counter to the next LED pattern for next pass if (end of pattern?) { reset to the top of the pattern } }

if (elapsed time for loop2 is met) { do the LED pattern update counter to the next LED pattern for next pass

if (end of pattern?) { reset to the top of the pattern } } } // end of loop

Be aware that "do the LED pattern" does NOT mean using delay(). Period. No delay()s. Period. Full stop.

They should change the name of delay(); to doNothing(); that would make more sense and let people realize easier its really only needed in a few places, not when you need a non stopping delay