Built with recycled elements, high brightness color LEDs and an RGB LED.
Things used in this project
Hardware components
HARDWARE LIST
1 Arduino UNO
8 High Brightness LED, Color
1 LED, RGB
3 Aluminum dissipator
1 Hard disk reading head
2 Glass Ball
1 Male/Female Jumper Wires
1 Breadboard (generic)
1 5V Power bank
Story
The Arduino Cyber Christmas Tree is an easy project to carry out. Manufactured with electronic garbage, some LEDs and an Arduino Uno board. It has an editable sequence code for turning the LEDs on and off. It can be used as a desktop tree, as it can be connected to a computer's USB port or a 5V power bank.
Schematics
conexion_PhRgaXx5kW.png
Code
Christmas_CyberTree.ino
Arduino
CODE
/*
Parpadeo de 8 LEDs
Secuencias de parpadeos de 8 LEDs + LED RGB
*/
//Declaracion de los pines como constantes:
const int LEDr=9; //Color rojo pin 9
const int LEDb=10; //Color azul pin 10
const int LEDg=11; //Color verde pin 11
//Declaracin de las variables necesarias:
int rojo=0;
int verde=0;
int azul=0;
int rled = 2; // Pin digital al que conectamos el LED rojo
int yled = 3; // Pin digital al que conectamos el LED amarillo
int bled = 4; // Pin digital al que conectamos el LED azul
int wled = 5; // Pin digital al que conectamos el LED blanco
int b2led = 6; // Pin digital al que conectamos el LED azul 2
int y2led = 7; // Pin digital al que conectamos el LED amarillo 2
int r2led = 8; // Pin digital al que conectamos el LED rojo 2
int wl = 12; // Pin digital al que conectamos el LED blanco 2
void setup() {
pinMode(rled, OUTPUT); // Configracin del pin 2 como salida
pinMode(yled, OUTPUT); // Configracin del pin 3 como salida
pinMode(bled, OUTPUT); // Configracin del pin 4 como salida
pinMode(wled, OUTPUT); // Configracin del pin 5 como salida
pinMode(b2led, OUTPUT); // Configracin del pin 6 como salida
pinMode(y2led, OUTPUT); // Configracin del pin 7 como salida
pinMode(r2led, OUTPUT); // Configracin del pin 8 como salida
pinMode(wl, OUTPUT); // Configracin del pin 12 como salida
setColor(0,255,255);
delay(50);
setColor(255,0,255);
delay(50);
setColor(255,255,0);
delay(50);
//Comprobacion todos los colores
setColor(255,255,255);
delay(50);
setColor(0,0,0);
delay(50);
setColor(255,255,255);
delay(50);
//Dejamos el color rojo para empezar el loop
setColor(255,0,255);
delay(10);
}
void loop()
{
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
//Se mantiene el rojo al maximo mientras sube el verde
for (int verde=255;verde>=0;verde--){
setColor(0,verde,255);
delay(1);
}
//Se mantiene el verde al maximo mientras baja el rojo
for (int rojo=0;rojo<=255;rojo++){
setColor(rojo,0,255);
delay(1);
}
//Se mantiene el verde al maximo mientras sube el azul
for (int azul=255;azul>=0;azul--){
setColor(255,0,azul);
delay(1);
}
//Se mantiene el azul al maximo mientras baja el verde
for (int verde=0;verde<=255;verde++){
setColor(255,verde,0);
delay(1);
}
//Se mantiene el rojo al maximo mientras baja el azul
for (int azul=0;azul<=255;azul++){
setColor(0,255,azul);
if(azul==255){
delay(1);
}
else{
delay(1);
}
}
/////////////
digitalWrite(rled, HIGH);
delay(20);
digitalWrite(yled, HIGH);
delay(20);
digitalWrite(bled, HIGH);
delay(20);
digitalWrite(wled, HIGH);
delay(20);
digitalWrite(b2led, HIGH);
delay(20);
digitalWrite(y2led, HIGH);
delay(20);
digitalWrite(r2led, HIGH);
delay(20);
digitalWrite(rled, LOW);
delay(20);
digitalWrite(yled, LOW);
delay(20);
digitalWrite(bled, LOW);
delay(20);
digitalWrite(wled, LOW);
delay(20);
digitalWrite(b2led, LOW);
delay(20);
digitalWrite(y2led, LOW);
delay(20);
digitalWrite(r2led, LOW);
delay(20);
////destello blanco////
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
/////////////
//Se mantiene el rojo al maximo mientras sube el verde
for (int verde=255;verde>=0;verde--){
setColor(0,verde,255);
delay(1);
}
//////
digitalWrite(rled, HIGH);
delay(10);
digitalWrite(rled, LOW);
delay(10);
digitalWrite(yled, HIGH);
delay(10);
digitalWrite(yled, LOW);
delay(10);
digitalWrite(bled, HIGH);
delay(10);
digitalWrite(bled, LOW);
delay(10);
digitalWrite(wled, HIGH);
delay(10);
digitalWrite(wled, LOW);
delay(10);
digitalWrite(b2led, HIGH);
delay(10);
digitalWrite(b2led, LOW);
delay(10);
digitalWrite(y2led, HIGH);
delay(10);
digitalWrite(y2led, LOW);
delay(10);
digitalWrite(r2led, HIGH);
delay(10);
digitalWrite(r2led, LOW);
delay(10);
///destello blanco///
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
/////
digitalWrite(rled, HIGH);
delay(10);
digitalWrite(rled, LOW);
delay(10);
digitalWrite(yled, HIGH);
delay(10);
digitalWrite(yled, LOW);
delay(10);
digitalWrite(bled, HIGH);
delay(10);
digitalWrite(bled, LOW);
delay(10);
digitalWrite(wled, HIGH);
delay(10);
digitalWrite(wled, LOW);
delay(10);
digitalWrite(b2led, HIGH);
delay(10);
digitalWrite(b2led, LOW);
delay(10);
digitalWrite(y2led, HIGH);
delay(10);
digitalWrite(y2led, LOW);
delay(10);
digitalWrite(r2led, HIGH);
delay(10);
digitalWrite(r2led, LOW);
delay(10);
///destello blanco///
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
/////
//Se mantiene el verde al maximo mientras baja el rojo
for (int rojo=0;rojo<=255;rojo++){
setColor(rojo,0,255);
delay(1);
}
//Se mantiene el verde al maximo mientras sube el azul
for (int azul=255;azul>=0;azul--){
setColor(255,0,azul);
delay(1);
}
//Se mantiene el azul al maximo mientras baja el verde
for (int verde=0;verde<=255;verde++){
setColor(255,verde,0);
delay(1);
}
//Se mantiene el rojo al maximo mientras baja el azul
for (int azul=0;azul<=255;azul++){
setColor(0,255,azul);
if(azul==255){
delay(1);
}
else{
delay(1);
}
}
/////////////
digitalWrite(rled, HIGH);
delay(30);
digitalWrite(yled, HIGH);
delay(30);
digitalWrite(bled, HIGH);
delay(30);
digitalWrite(wled, HIGH);
delay(30);
digitalWrite(b2led, HIGH);
delay(30);
digitalWrite(y2led, HIGH);
delay(30);
digitalWrite(r2led, HIGH);
delay(30);
digitalWrite(wl, HIGH);
delay(30);
//
digitalWrite(rled, LOW);
delay(30);
digitalWrite(yled, LOW);
delay(30);
digitalWrite(bled, LOW);
delay(30);
digitalWrite(wled, LOW);
delay(30);
digitalWrite(b2led, LOW);
delay(30);
digitalWrite(y2led, LOW);
delay(30);
digitalWrite(r2led, LOW);
delay(30);
digitalWrite(wl, LOW);
delay(30);
////
//Se mantiene el rojo al maximo mientras sube el verde
for (int verde=255;verde>=0;verde--){
setColor(0,verde,255);
delay(1);
}
//Se mantiene el rojo al maximo mientras sube el verde
for (int verde=30;verde>=0;verde--){
setColor(0,verde,30);
delay(1);
}
//////
digitalWrite(rled, HIGH);
delay(30);
digitalWrite(rled, LOW);
delay(30);
digitalWrite(yled, HIGH);
delay(30);
digitalWrite(yled, LOW);
delay(30);
digitalWrite(bled, HIGH);
delay(30);
digitalWrite(bled, LOW);
delay(30);
digitalWrite(wled, HIGH);
delay(30);
digitalWrite(wled, LOW);
delay(30);
digitalWrite(b2led, HIGH);
delay(30);
digitalWrite(b2led, LOW);
delay(30);
digitalWrite(y2led, HIGH);
delay(30);
digitalWrite(y2led, LOW);
delay(30);
digitalWrite(r2led, HIGH);
delay(30);
digitalWrite(r2led, LOW);
delay(30);
///destello blanco///
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
/////
//Se mantiene el azul al maximo mientras baja el verde
for (int verde=0;verde<=255;verde++){
setColor(255,verde,0);
delay(1);
}
//Se mantiene el rojo al maximo mientras baja el azul
for (int azul=0;azul<=255;azul++){
setColor(0,255,azul);
if(azul==255){
delay(1);
}
else{
delay(1);
}
}
////
digitalWrite(rled, HIGH);
delay(60);
digitalWrite(rled, LOW);
delay(30);
digitalWrite(yled, HIGH);
delay(60);
digitalWrite(yled, LOW);
delay(30);
digitalWrite(bled, HIGH);
delay(60);
digitalWrite(bled, LOW);
delay(30);
digitalWrite(wled, HIGH);
delay(60);
digitalWrite(wled, LOW);
delay(30);
digitalWrite(b2led, HIGH);
delay(60);
digitalWrite(b2led, LOW);
delay(30);
digitalWrite(y2led, HIGH);
delay(60);
digitalWrite(y2led, LOW);
delay(30);
digitalWrite(r2led, HIGH);
delay(60);
digitalWrite(r2led, LOW);
delay(30);
///destello blanco///
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
/////
//Se mantiene el azul al maximo mientras baja el verde
for (int verde=0;verde<=50;verde++){
setColor(50,verde,0);
delay(1);
}
//Se mantiene el rojo al maximo mientras baja el azul
for (int azul=0;azul<=55;azul++){
setColor(0,55,azul);
if(azul==55){
delay(1);
}
else{
delay(1);
}
}
/////////////
digitalWrite(rled, HIGH);
delay(50);
digitalWrite(rled, LOW);
delay(50);
digitalWrite(yled, HIGH);
delay(50);
digitalWrite(yled, LOW);
delay(50);
digitalWrite(bled, HIGH);
delay(50);
digitalWrite(bled, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(b2led, HIGH);
delay(50);
digitalWrite(b2led, LOW);
delay(50);
digitalWrite(y2led, HIGH);
delay(50);
digitalWrite(y2led, LOW);
delay(50);
digitalWrite(r2led, HIGH);
delay(50);
digitalWrite(r2led, LOW);
delay(50);
//////////
///destello blanco///
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
digitalWrite(wl, HIGH);
delay(5);
digitalWrite(wl, LOW);
delay(100);
/////////////
digitalWrite(rled, HIGH);
delay(100);
digitalWrite(r2led, HIGH);
delay(100);
digitalWrite(yled, HIGH);
delay(100);
digitalWrite(y2led, HIGH);
delay(100);
digitalWrite(bled, HIGH);
delay(100);
digitalWrite(b2led, HIGH);
delay(100);
digitalWrite(wled, HIGH);
delay(100);
digitalWrite(rled, LOW);
delay(50);
digitalWrite(r2led, LOW);
delay(50);
digitalWrite(yled, LOW);
delay(70);
digitalWrite(y2led, LOW);
delay(70);
digitalWrite(bled, LOW);
delay(100);
digitalWrite(b2led, LOW);
delay(150);
digitalWrite(wled, LOW);
delay(200);
///////////////////////////
digitalWrite(rled, HIGH);
digitalWrite(r2led, HIGH);
delay(200);
digitalWrite(yled, HIGH);
digitalWrite(y2led, HIGH);
delay(200);
digitalWrite(bled, HIGH);
digitalWrite(b2led, HIGH);
delay(200);
digitalWrite(wled, HIGH);
delay(200);
digitalWrite(rled, LOW);
digitalWrite(r2led, LOW);
delay(300);
digitalWrite(yled, LOW);
digitalWrite(y2led, LOW);
delay(300);
digitalWrite(bled, LOW);
digitalWrite(b2led, LOW);
delay(300);
digitalWrite(wled, LOW);
delay(300);
///////
//Se mantiene el azul al maximo mientras baja el verde
for (int verde=0;verde<=0;verde++){
setColor(0,verde,0);
delay(1);
}
//Se mantiene el rojo al maximo mientras baja el azul
for (int azul=0;azul<=5;azul++){
setColor(0,10,azul);
if(azul==0){
delay(1);
}
else{
delay(1);
}
}
//////
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
//
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
digitalWrite(wl, HIGH);
delay(50);
digitalWrite(wl, LOW);
delay(50);
digitalWrite(wled, HIGH);
delay(50);
digitalWrite(wled, LOW);
delay(50);
///////////////////////////
//Se mantiene el rojo al maximo mientras baja el azul
for (int azul=0;azul<=255;azul++){
setColor(0,255,azul);
if(azul==255){
delay(1);
}
}
///////////////////////////
///raya/////////////////
digitalWrite(wled, HIGH);
digitalWrite(yled, HIGH);
digitalWrite(y2led, HIGH);
digitalWrite(bled, HIGH);
digitalWrite(b2led, HIGH);
digitalWrite(rled, HIGH);
digitalWrite(r2led, HIGH);
delay(500);
digitalWrite(wled, LOW);
digitalWrite(yled, LOW);
digitalWrite(y2led, LOW);
digitalWrite(bled, LOW);
digitalWrite(b2led, LOW);
digitalWrite(rled, LOW);
digitalWrite(r2led, LOW);
delay(200);
digitalWrite(wled, HIGH);
digitalWrite(yled, HIGH);
digitalWrite(y2led, HIGH);
digitalWrite(bled, HIGH);
digitalWrite(b2led, HIGH);
digitalWrite(rled, HIGH);
digitalWrite(r2led, HIGH);
delay(500);
digitalWrite(wled, LOW);
digitalWrite(yled, LOW);
digitalWrite(y2led, LOW);
digitalWrite(bled, LOW);
digitalWrite(b2led, LOW);
digitalWrite(rled, LOW);
digitalWrite(r2led, LOW);
delay(200);
////punto//////////////////
digitalWrite(wled, HIGH);
digitalWrite(yled, HIGH);
digitalWrite(y2led, HIGH);
digitalWrite(bled, HIGH);
digitalWrite(b2led, HIGH);
digitalWrite(rled, HIGH);
digitalWrite(r2led, HIGH);
delay(70);
digitalWrite(wled, LOW);
digitalWrite(yled, LOW);
digitalWrite(y2led, LOW);
digitalWrite(bled, LOW);
digitalWrite(b2led, LOW);
digitalWrite(rled, LOW);
digitalWrite(r2led, LOW);
delay(200);
digitalWrite(wled, HIGH);
digitalWrite(yled, HIGH);
digitalWrite(y2led, HIGH);
digitalWrite(bled, HIGH);
digitalWrite(b2led, HIGH);
digitalWrite(rled, HIGH);
digitalWrite(r2led, HIGH);
delay(70);
digitalWrite(wled, LOW);
digitalWrite(yled, LOW);
digitalWrite(y2led, LOW);
digitalWrite(bled, LOW);
digitalWrite(b2led, LOW);
digitalWrite(rled, LOW);
digitalWrite(r2led, LOW);
delay(200);
////////////////////////////
digitalWrite(rled, HIGH);
delay(70);
digitalWrite(yled, HIGH);
delay(65);
digitalWrite(bled, HIGH);
delay(60);
digitalWrite(wled, HIGH);
delay(55);
digitalWrite(y2led, HIGH);
delay(50);
digitalWrite(b2led, HIGH);
delay(45);
digitalWrite(r2led, HIGH);
delay(40);
digitalWrite(wl, HIGH);
delay(100);
digitalWrite(rled, LOW);
delay(40);
digitalWrite(yled, LOW);
delay(45);
digitalWrite(bled, LOW);
delay(50);
digitalWrite(wled, LOW);
delay(55);
digitalWrite(b2led, LOW);
delay(60);
digitalWrite(y2led, LOW);
delay(65);
digitalWrite(r2led, LOW);
delay(70);
digitalWrite(wl, LOW);
delay(100);
///////////////////////////
digitalWrite(rled, HIGH);
delay(70);
digitalWrite(yled, HIGH);
delay(65);
digitalWrite(bled, HIGH);
delay(60);
digitalWrite(wled, HIGH);
delay(55);
digitalWrite(y2led, HIGH);
delay(50);
digitalWrite(b2led, HIGH);
delay(45);
digitalWrite(r2led, HIGH);
delay(40);
digitalWrite(wl, HIGH);
delay(100);
digitalWrite(rled, LOW);
delay(40);
digitalWrite(yled, LOW);
delay(45);
digitalWrite(bled, LOW);
delay(50);
digitalWrite(wled, LOW);
delay(55);
digitalWrite(b2led, LOW);
delay(60);
digitalWrite(y2led, LOW);
delay(65);
digitalWrite(r2led, LOW);
delay(70);
digitalWrite(wl, LOW);
delay(100);
///////////////////////////
digitalWrite(rled, HIGH);
delay(30);
digitalWrite(yled, HIGH);
delay(25);
digitalWrite(bled, HIGH);
delay(20);
digitalWrite(wled, HIGH);
delay(15);
digitalWrite(y2led, HIGH);
delay(10);
digitalWrite(b2led, HIGH);
delay(5);
digitalWrite(r2led, HIGH);
delay(1);
digitalWrite(rled, LOW);
delay(1);
digitalWrite(yled, LOW);
delay(5);
digitalWrite(bled, LOW);
delay(10);
digitalWrite(wled, LOW);
delay(15);
digitalWrite(b2led, LOW);
delay(20);
digitalWrite(y2led, LOW);
delay(25);
digitalWrite(r2led, LOW);
delay(30);
}
///////////////////////////
void setColor(int red,int green,int blue)
{
analogWrite(LEDr,red);
analogWrite(LEDg,green);
analogWrite(LEDb,blue);
}
////FELIZ///NAVIDAD////////
The article was first published in hackster, December 21, 2019
cr: https://www.hackster.io/Guiye_Perez_Bongiovanni/christmas-cybertree-usb-arduino-daed9e
author: Guiye Perez Bongiovanni
License
All Rights
Reserved
1
More from this category