fighting with the coding again! 2 x 1m ws2811, 32 leds per metre,

fighting with the coding again!

2 x 1m ws2811, 32 leds per metre, and with the strips next to each other I’ve managed to force them into “sync”, so when pixel 0 is lit, so is 33, 1&34, 2&35.

now i found the nscale8 command which allows me to fade to black, or better known as “make the leds look pretty” but when it gets halfway along the strip, it locks up the mc, to the point where i have to time plugging it in the usb as to get it into program mode.

is this a limitation of the deek-robot arduino pro mini clone, or a limitation of my knowledge?

It’d help if you showed the code - I suspect you have something in you’re code that’s doing a buffer overflow, aka walking off the end of the array of led data and writing into something (maybe messing with a return address on the stack and throwing you into random code).

erm, fastled 2.1 and the code;

for(int i = 0; i < 32; i++) {
// Set the i’th led to red
leds[i] = CRGB::Red;
leds[63 - i] = CRGB::Red;
// Show the leds
FastLED.show();
// now that we’ve shown the leds, reset the i’th led to black
//leds[i] = CRGB::Black;
//leds[63 - i] = CRGB::Black;
leds[i].nscale8(fade);
// Wait a little bit before we loop around and do it again
FastLED.delay(30);

apologies, forgot the code!

What’s the rest of the code look like? (your declaration of leds, your setup calls, etc…)

Oh, also, make sure you update to at least FastLED 3.0 (er, 3.0.3, that is) - various 2.1 releases had a bug in FastLED.delay which would screw up the world.

http://pastebin.com/dATVtkpB
thats the full code, as paltry as it is.

im not good at coding.

Your allleds array data is off by one. The first position of the second strip is 32, not 33, and the last position is 63, not 64. Those values are offsets into the string – you correctly started at 0.

The array seemed clumsy, is there a way of doing the same thing but with loops, but without nesting them?

Actually, the way you’ve done it (matching i and 63 - i) is the way to do it without using the array. I was a bit sleepy last night, because while my comment about 63 versus 64 was accurate, it has no effect on the code you put up. Your code doesn’t use the array, it doesn’t use the sensor input data, and it doesn’t use the nscale8 function. Those things are either un-referenced or commented out.

I’ve now realised where i went wrong with the array, and fixed that issue. I’ve worked out the nscale8, and thats all pretty again, and found a major realisation, that you only need to call FastLed.Show once… not sure where you have to call it, but when its outside the for loop then it all runs a lot smoother.

You call show after you’ve made all the changes you want to an entire frame. The initial code that you pasted looks like it was based on a simple loop of turning a light on and then off, going down the set of leds - so it was calling show after the change was made for that frame (e.g. turning a single led on).