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.
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)
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!