Bad code, something isnt quite right Hi guys I have a whole load of

Bad code, something isnt quite right

Hi guys

I have a whole load of LED’s set up. I have 14x2.5m strips of APA102c connected to a Teensy 3.2+prop shield. Power output is all fine too.

When i run some animations, such as the Rainbow example, or some simple ones, there is no problem whatsoever. However, when I run a really simple one to do a white strip, and nothing else, the strip seems to become corrupted in places, and also the white becomes quite yellow-y.
any thoughts as to why this would happen?
My code is below

#include “FastLED.h”
#define NumPixels 150
#define Datapin 11
#define Clockpin 13
#define DataRate_Mhz 12
CRGB leds[NumPixels];
int r = 255, g = 255, b = 25;

void setup()
{
FastLED.addLeds<APA102,Datapin,Clockpin,BGR,DATA_RATE_MHZ(DataRate_Mhz)>(leds,NumPixels).setCorrection(CRGB( 255, 160, 240));

fill_solid(leds, NumPixels, CRGB(0,0,0)); // fill all to empty
FastLED.show();
pinMode(7, OUTPUT); // using the prop shield this is required
digitalWrite(7, HIGH); // using the prop shield this is required
delay(2000);
}

void loop()
{
fill_solid(leds, NumPixels, CRGB(r,g,b)); // fill all to colour
FastLED.show();
delay(5000);
}

The APA102s sometimes struggle with long lengths. It’s odd that it’s with some patterns and not others, but I’d try turning the data rate down. Also are you using a level shifter, capacitors, resistors?
Also try replacing delay with FastLED.delay()

Sounds like a power issue. You don’t say how big your power supply is and whether you’re injecting power every few meters or not.

ah false alert. I found the error, I had the blue set to 25, not 255 and also I had the data rate set too high and it didnt like it. as soon as I reduced the data rate to 4mhz it worked fine. It was fine to reduce it as it is not speed critical for me

@Brian_Lewis thanks for the input, but it was related to the speed, always a dodgy issue with me/APA102

@Jeremy_Spencer I think we have spoken about long lengths in the past and the nightmare they cause, but this is only 2.5m, it’s a branched out work so no far distances. Spot on with turning the data rate down. I turned it to 4mhz and it’s all fine now
The prop shield, is a level shifter in essence, not using any other capacitors or resistors

Finally, what’s the difference between delay and FastLED.delay?

Using delay (an Arduino command) pauses/stops everything.

FastLED.delay pauses from moving on in the program but it calls FastLED.show() one or more times during the delay time so the pixels continue to be updated.

@Tejkaran_Samra from your initial description I totally guessed that was a power issue. Thanks for reporting it was data rate. Will have to keep that in mind.