Circuit LED Icicle Lights Arduino
I had the idea of building this
Arduino icicle lights project during the making of the light dimmer circuit and the result can be seen below. Is not a complicated project so it can be done easily by anyone who has an Arduino board or an Atmel microcontroller with bootloader on it.
I have used red LEDs because at the moment the white and blue ones were used in another circuits so the result is not too interesting but will definetely look fabulous with white or blue LEDs.
//Source: Picture of Good Electronic Circuit/
int pins[] = {3,5,6,9,10,11};
int leds = sizeof(pins)/2;
void setup() {
for(int thispin = 0; thispin < leds; thispin++) {
pinMode(pins[thispin], OUTPUT);
}
}
void loop() {
for(int i = 0; i < leds; i++) {
digitalWrite(pins[i], HIGH);
if(i == 0) { // if first led delay for x ms
delay(200);
}
if(i > 0) {
int a = i-1;
for (int t = 64; t >= 0; t--){
analogWrite(pins[a], t);
delay(5);
}
}
delay(50); // change for different drop speed
if(i == leds-1) { // if last led
delay(1000); // how long the last led stays on
// here starts the code for the fade out effect
for (int t = 255; t >= 0; t--){ // a fadding effect
analogWrite(pins[i], t);
delay(5);
}
delay(300);
// here ends the code for the fade out effect
}
Serial.println(i);
digitalWrite(pins[i], LOW);
}
}
This sketch is a bit different from the one presented in the video and has a small fade out effect on the last led. It stays on for 1000 ms, then slowly fades out and waits for 300 ms before the first led turns on again and the process is repeated over and over again.