ingrimsch:
First of all I would create an array that holds the amount of leds. Then I would loop through that array setting them to my desired base color.
FastSPI takes care of the array for you:
// code based on FastSPI_LED. FastSPI_LED2 is slightly different
#include <FastSPI_LED.h>
#define NUM_LEDS 32
struct CRGB { unsigned char b; unsigned char r; unsigned char g; };
struct CRGB *leds;
void setup() {
...
}
void loop() {
for (int px = 0; px < NUM_LEDS) px++) {
leds[px].r = 0;
leds[px].g = 0;
leds[px].b = 128; //any value between 0 to 255
}
FastSPI_LED.show();
...
}
Now you have a blue string.
ingrimsch:
I might even get a random fade working by looking at examples, but I'm not sure how to keep track of the leds that are fading right now and how to limit them to an amount of 3 or 4 at a time.
Arrays. Picking a random LED is easy, just hit a random(NUM_LEDS) to pick one. As for keeping track of which ones are in a 'fade' phase, keep an array with their index numbers. So after selecting the random LED, insert that value into an array so that let's say you have LEDs 4, 7, and 13 fading, put those three values in an array.
This allows you to then use that array to remember which LEDs are fading, and by counting how many elements the array has in it, you will know how many LEDs are fading and you can set your limits based on that.
ingrimsch:
I would have to count the currently fading leds and loop them like "if less than 4 are fading now, fade the current led". But that would not create the kind of randomness I'm trying to archieve... My only idea here would be a small (random?) delay.
Yep, you can do that too. If you look at my video, there's one pattern that's all about randomness, it's a white and blue twinkling one. It randomly picks which LED to address next. It checks whether that LED is currently on and ignores it. It randomly chooses what color that LED will be when it turns on. And it randomly select both how long the LED is turned on for and how long it remains off afterwards.
The rain/snow like one also has randomness built into it: how fast the flake falls, how bright the flake is, and the delay between flakes. Random is a fun thing to play with.