I'm trying to create a rain effect on a 8X5 array on neopixles.

I’m trying to create a rain effect on a 8X5 array on neopixles. So far I’v gotten two rows to move the white LED down to the end and loop back to the top. The issue that I’m having is that the moving leds are not in sync. the first row moves much slower that the second row. How do I get the leds in sync so they both move at the same speed and side by side? This is what I have so far. fastled-rain-snow-effect/new-rain.ino at master · orangeofdoom/fastled-rain-snow-effect · GitHub

#include “FastLED.h” // This sketch uses the FastLED library

#define DATA_PIN 6 // Data connected to Digital Pin 2 on the Arduino

#define LED_TYPE WS2811 // This LED strip uses the WS2801 chipset.
#define NUM_LEDS 40

CRGB leds[NUM_LEDS];

void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(2000);
LEDS.addLeds<LED_TYPE, DATA_PIN, RGB>(leds, NUM_LEDS);
}

void loop() {
// Move a single white led
for(int Row1 = 0; Row1 < 8; Row1 = Row1 + 1) for(int row2 = 8; row2 <16; row2 = row2 +1) {
leds[Row1] = CRGB::White; leds[row2] = CRGB :: White; FastLED.show();
delay(100);
leds[Row1] = CRGB ::Black;
leds[row2] = CRGB ::Black;

  FastLED.show();

}
}

Any help would be greatly appreciated

Jeff,

Update all the led positions first, then fall out of the for loop and call show. That should work.

The loop for row2 is inside the loop for row1
That make the row2 loop run 8 times and row1 is run 1 time

@Peter_Buelow Thanks for the reply, unfortunately I am very new to programming and I don’t quite understand how to make the changes you suggested. I tried to implement what you said and ended up with this
void loop() {
// Move a single white led
for(int Row1 = 0; Row1 < 8; Row1 = Row1 + 1) for(int row2 = 8; row2 <16; row2 = row2 +1) {
leds[Row1] = CRGB::White; leds[row2] = CRGB :: White;}
delay(1000);
FastLED.show();

for(int Row1 = 0; Row1 < 8; Row1 = Row1 + 1) for(int row2 = 8; row2 <16; row2 = row2 +1)
{leds[Row1] = CRGB ::Black; leds[row2] = CRGB ::Black;}
delay(1000);
FastLED.show();

They all blink in sync now but all 8 LEDs are on in a solid line instead of one by one. Could you point me to where I’m going wrong?

I did something similar earlier this year. Can you post your code to pastebin? I’ll take a look at it and see if I can help. https://plus.google.com/+BrianLewis515/posts/1s5R3XhpAFX
https://plus.google.com/+BrianLewis515/posts/1s5R3XhpAFX

https://www.instagram.com/p/BCYU2Fhv4-P/?taken-by=blink515&hl=en
https://www.instagram.com/p/BCYU2Fhv4-P/?taken-by=blink515&hl=en

@Brian_Lewis yes I was looking for your rain animation to help him- but couldn’t remember exactly who posted it. Planned to pull it out of my arduino folder when I got on the computer and totally forgot.

@Brian_Lewis Your work with the light cube actually inspired me to make this . Anyway, here is the pasetbin.

http://pastebin.com/Sp0sm1EN

Thanks for the help!
http://pastebin.com/Sp0sm1EN

@JeffJerzy1 ​ could also post a picture of your LEDs so I can get an idea of the layout?

@JeffJerzy1 Are you trying to get two LEDs to move from the top down or just one at a time? Comments in your code say 2 but I want to make sure. Is your array 8 Wide X5 High? Is it a serpentine layout?

@Brian_Lewis Sorry for the delay I’ve been very busy. I’m trying to get a led to move from right to left along each row. I want to get all 5 rows moving at the same time. thanks for the help.

missing/deleted image from Google+

@JeffJerzy1 ​ I am done with the code for this. I want to test it before I give it to you but unfortunately I have an 8 hour drive home so you’ll have to wait until later tonight or tomorrow for it.

void loop(){ // slide all the pixels data down the line
uint8_t hue =0;
byte idex = 0;
byte PixelHeight = 5 //set to how many pixel the pattern will repeat
memmove8( &leds[1], &leds[0], (NUM_LEDS - 1) * 3 ); // copy color data from pixel [0] to pixel [1] …
idex++; // increment the display frame
if ( idex > PixelHeight ) { idex = 0; hue += 32; } // cycle through hues color
switch ( idex ) {
case 0: leds[0] = CHSV(hue,255,255); break;
case 1: leds[0] = CHSV(hue , 255, 200); break;
case 2: leds[0] = CHSV(hue , 255, 150); break;
case 3: leds[0] = CHSV(hue , 255, 100); break;
case 4: leds[0] = CHSV(hue, 255, 50); break;
default: leds[0] = CRGB::Black;
}

FastLED.show();
delay(100); // control the animation speed/frame rate
}

@JeffJerzy1 You may need to change the pin number to something other than 6 but I think that is the default for the array you are using. You also might need to set the Serpentine layout to true if the leds aren’t lined up. https://gist.github.com/Blink515/fdbca42f80203ba137afb55c19983eba

@Brian_Lewis thank you for efforts to help me out, I’ll give the code a whirl tomorrow and report back.