The main loop repeats after it finishes.
You need to put some delays in there to stop the program from doing anything while displaying those LEDs. (eg: sleep(500) - which is 500 millseconds), before it moves on to the next part.
Otherwise what happens is:
Sets the display to BLACK (all off).
Immediately turns on the BLUE LEDs
Immediately after that, turns on the RED LEDs.
Goes back to the top of the loop.
And it does this all as fast as it can.
That last step does take longer than the steps in between (how much depends on the Arduino, it's clock speed, the size of the code, how you're setting the outputs, etc).
The "Cube4" is a 4x4x4 RGB LED cube with an Arduino Leonardo compatible onboard controller. [Product page]
1 post •Page 1 of 1