yay! almost working! so i almost have perfection! the following code runs through the

yay!

almost working!

so i almost have perfection!

the following code runs through the 6 states (1-6) and flashes the corresponding leds on the cube, and whilst the code is fine, the serial output is fine, everything looks good.

the physical output is however a little off. power source, wiring, loose connections are not the reason as other code is working fine.

im getting some erroneous colours, im just using CRGB:Red, but i get an led on 1/4 brightness green on one side, and a consistent 1/2 brightness red and a run through of random colours on another led.

http://pastebin.com/BMqm6Mig

https://www.youtube.com/watch?v=APUddl2aTB8 (video is processing…!)

any ideas?

output from serial monitor, which is the address of the led that is currently lit.

State: 1 || 6 7 10 11 2 3 8 9
State: 2 || 8 9 0 1 10 11 4 5
State: 3 || 8 9 2 3 10 11 6 7
State: 4 || 4 5 10 11 0 1 8 9
State: 5 || 6 7 0 1 2 3 4 5
State: 6 || 4 5 2 3 0 1 6 7

I think what’s causing the other erroneous colors is you’ve defined NUM_LEDS as 12, but when you create
CRGB leds[NUM_LEDS_IN_SEGMENT * NUM_SIDES]
multiplying segments times sides is only 8, not 12.

The logic in that is… The original setup tells the system that there is 12 leds in total, but I only want to light up 8 at a time.
The code creates the individual LED addresses to light.
I am fearing more towards a more simpler result, in that led 1 in the chain is coded here as 0… So when I’m trying to light led 0 it’s causing issues. Annoyingly all the other LEDs in the sequence are fine :-/

If I do a simple +1 to the result of the maths then I get errors (on the serial monitor) where as if I put in -1, the code results fine (albeit with incorrect led positions)

Ho hum…

I’ll try setting NUM_LEDS to 8 when I get home tonight and see what the result is.

If your setup has 12 pixels wired up then keep NUM_LEDS defined as 12 and create CRGB leds as:
CRGB leds[NUM_LEDS];

If you only want to light up 8 pixels (ie 4 sides) of the 12 pixels at a time that’s fine, but the array you create needs to be large enough to hold all 12.

yep! schoolboy error… CRGB in the main code is set right, but when i tried to remove the broken code and redo (as is my usual way of fixing things) i set the crgb wrong… its now working perfectly! thanks!