Hello, FastLED Users! I am in need of help.

Hello, FastLED Users! I am in need of help. I am a newbie on coding and on working with addressable leds and I am currently working on a project that involves neopixels and an IR sensor.

I’m using the FastLed effects from Tweaking4All (see links below.) for my code. I currently like the fading effect of the Meteor Rain from Tweaking4All, but I would like to make it start from the center then outwards, ending on both ends of the strip, but I seem to have a bit of trouble in doing so and the fading effect is no longer present in the output of my program. :frowning:

Here is part of the code below:
it is derived from both NEW KITT and METEOR RAIN from Tweaking4All Tutorials.


void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay, int ReturnDelay) {
setAll(0,0,0);

for(int i = 0; i < NUM_LEDS+NUM_LEDS; i++) {

// fade brightness all LEDs one step
for(int j=0; j<NUM_LEDS; j++) {
  if( (!meteorRandomDecay) || (random(10)>5) ) {
    fadeToBlack(j, meteorTrailDecay );        
  }
}

// draw meteor + NEW KITT
for(int i =((NUM_LEDS-meteorSize)/2); i>=0; i--) {
setAll(0,0,0);

setPixel(i, red/10, green/10, blue/10);
for(int j = 1; j <= meteorSize; j++) {
  setPixel(i+j, red, green, blue); 
}
setPixel(i+meteorSize+1, red/10, green/10, blue/10);

setPixel(NUM_LEDS-i, red/10, green/10, blue/10);
for(int j = 1; j <= meteorSize; j++) {
  setPixel(NUM_LEDS-i-j, red, green, blue); 
}
setPixel(NUM_LEDS-i-meteorSize-1, red/10, green/10, blue/10);

showStrip();
delay(SpeedDelay);

}
delay(ReturnDelay);
}
}

Thanks in advance!

LINKS:

NeoPixels, and IR sensor and Arduino UNO with FastLED are not a good combination.

If you wish to use IR with NeoPixels and FastLED, then you need to use a Teensy or other high speed board.

If you wish to use IR with an UNO and FastLED, then you need a 4 pin strip, such as APA102.

The reason is that FastLED disables interrupts on an UNO to drive the NeoPixels. Those interrupts are required by the IR routines.

In my case, I use an Arduino Nano with 4 pin APA102’s and an IR sensor.

As for your code, that appears to be a mishmash of ADAFRUIT_NEOPIXEL_H and FastLED. I’m not sure.

Also, if you’re new to coding, I’d recommend trying out much simpler FastLED native code than that, such as:

The tweaking4all site appears to combine FastLED and ADAFRUIT libraries, thus making things much more difficult to understand.

@Andrew_Tuline Thanks for letting me know! I am currently testing the code on my arduino nano. Then I will be using DfRobot Bluno Beetle for this project once it’s polished, would this be alright?
The IR sensor will serve as a switch that will indicate the neopixel to change effects; code seems to work fine for the regular meteor rain effect (which I might have to deal with if I cant get the effect I want.)

Yeah I find it quite complicated. I found it on a youtube video showing the tweaking4all fastLed effects, which I liked. Then I patterned my code from there, thus the mish mash (which I wasn’t aware of.) Thanks again for the recommendations!!

@Roan_Alvarez Although I’ve got a couple of other boards, I only use Nano’s, so I don’t know how the Beetle would work for you.

Either way, I’ll create a number of simple test sketches prior to integration to ensure that I know things will work together. Better to debug a single issue with a test sketch than multiple issues with your final project.

The Beetle board basically works the same as an Arduino Leonardo. Should work fine, but you still might want to use apa102 (four wire strips) in conjunction with the IR sensor.

@Andrew_Tuline @marmil I am using these wires that came with my neopixels not sure if they are apa102 since there’s two extra wires connected to 5v and gnd (which I just found out now that it should be connected to the powersupply lol)
missing/deleted image from Google+

The two extra wires are to apply 5V and Gnd to the other end of the strip. Those are WS2812.

If multiple strips are strung together power needs to be injected every so often. Those wires provide a convenient way to to that.

Thanks again, +Andrew Tuline and +Marc Miller for shedding light on this! Greatly appreciate it.