Hi there, I'm trying to create a LED strip controller using arduino, and as for now I've managed to get it up and running with basic tests.
I want to control my LED strip using a RC controller, which works fine for now, but now my problem comes; Lets say i want to have 10 modes of different blinking/colour patterns on the LEDS, how would i do that?
I figured i wanted to make a for loop to count how many times the switch on the RC controller turns on and of, and thats fine, but how do i engage a new loop or something to take care of the leds?
As easy as that? Can i write a function with a new loop with delays that blinks the LEDs? Or do i have to call the function every time in the existing loop?
jastrup:
As easy as that? Can i write a function with a new loop with delays that blinks the LEDs? Or do i have to call the function every time in the existing loop?
A function is like a grouping of commands. Instead of writing the same commands over and over again you just write them once in a function, then call that function whenever you want to run those commands.
When you call a function only that function happens until it's finished, then your main program carries on.
If you want more than one thing to appear to happen at the same time you should never ever use delay(). Instead, look at the BlinkWithoutDelay example, and also investigate the use of Finite State Machines.
I've experimented some now with millis() and getting the blinks to appear without delays, but still i encounter some issues which i seem to need delay for.
Lets say i have two strips, A and B.
If i want to Blink A twice with a delay of 50ms, and then wait 500ms before i blink B twice, i can't figure out how to do that without using delays, even tho i don't want to use
delays.