Hey there!
Well, what the numbers mean ...
void FadeIn(byte red, byte green, byte blue) {
float r, g, b;
//below paragraph: parameters for the 1st fade - fading 'ON' or 'UP'//
for (int k = 0; k < 256; k = k + 1)
{ //0 on this line stands for 'off' and '256' is the maximum brightness to go to//
r = (k / 256.0) * red;
g = (k / 256.0) * green;
b = (k / 256.0) * blue;
setAll(r, g, b);
showStrip();
}
}
For colors, the mac value of each RGB element is 255. So White would be 255,255,255.
To Fade into a given color we'd have at most 256 steps (0 to 255).
So lets say we'd want to fade into white (255, 255, 255 or in hexadecimal notation: 0xFF, 0xFF, 0xFF), we'd follow this sequence:
0,0,0 - 1,1,1 - 2,2,2 - 3,3,3 - ... - 254,254,254 - 256,256,256
However, when designing this function we do not know yet what the target color will be. We do however know that at most it will be 256 steps at the most. So this is why I have chosen for to multiply each RGB element by a 256-fraction (eg. k/256).
So this way, each RGB element has 256 steps, and the max is reach when we do 256/256 * color. (since 256/256 = 1)
As for the delay numbers:
Posted by: @asa123456789
delay(1000ul*60*5)
This means 1000 milliseconds in a second * 60 seconds in a minute * 5 minutes.
We add "UL" to make the "1000" a unsigned long integer - this forces the result to become a unsigned integer.
This is to prevent that (for example) a regular integer will be used.
A regular Integer could have a max value of 32768, but our calculation (1000*60*5=300000) would go beyond that and the outcome will become unpredictable and most certainly incorrect.
To power the strips, you'd most certainly need a good power supply. With 150 leds, you'd theoretically need a capacity of 150 * 3 * 20mA (one LED block on the strip, actually has 3 LEDs in it, one for red, one for green and one for blue, and each of those pulls 20mA max). So this would result in 9000 mA (max) = 9 A. Now keep in mind that this would be needed when you set your entire strip to white at max brightness.
In my experience (depending on your project!) you may not need this much, so when your strip changes colors often, you may get away with a less powerful power supply. I've had most projects work just fine with taking somewhere between 1/3 and 2/3 of the calculated max, so in your case for a 150 LED strip maybe somewhere 3A and 6A may be fine.
Since you want 3x 150 LEDs, your power supply may need to be pretty potent (between 9A and 18A, or max 27A).
A 5V 27A power supply may be hard to find ... so using 3 separate power supplies can work very well as well.
To hook this up:
1) Make sure Arduino, LED strips and all power supplies have GND in common (so connect Arduino GND to GND of each power supply, and to GND of each LED strip.
2) +5V of the power supply will only go to each individual LED strip.
If you have the Arduino as stand alone (not connected to its own power supply and not connected to the USB of your computer), then you can use the +5V of one of the power supplies to power the Arduino.
Note that with long strands, the brightness may reduce towards the end of the strip. To prevent this, connect the +5V of the power supply connected to that strip, is also connected to the +5V at the end of the LED strip. For very long strands, you can even connect that +5V somewhere in the middle of the strand to +5V to "freshen up" the +5V.
Use this only if needed (you'll notice if this would affect your strands: the last LEDs get dimmer).