[Aporte] Cubo LED 2^3

#1
Hola a toda la comunidad!:D Dejo como aporte un cubo LED de 2x2x2 con su respectivo programa de Arduino con 11 simpáticas animaciones.
Aprovecho para consultar si alguien quiere hacerme sugerencias para mejorar mis habilidades de programación o de como optimizar el código.

Pido disculpas a los moderadores si esta no es la forma correcta de incorporar el código para que la gente lo extraiga, y de ser así les agradeceré que me indiquen cómo subirlo.

Gracias y saludos!:)

PHP:
/*Programa de Cubo LED 2x2x2 V1.1.0 por Juan Manuel Tamarit. 2015.
  Cubo LED de ánodos=columnas y cátodos=capas (en adelante "layers"). 
  Cada columna tiene resistencia de 220 Ohm. 
  Cada layer transistorizada: colector a layer, base a Arduino
  con resistencia de 15 KOhm y emisor a GND. */

int col[] = {10, 9, 6, 5};
int lay[] = {4, 2};

void setup()
{
  pinMode(13, OUTPUT);
  for (int i = 0; i < 4; i++) //Declaración de los pines de las columnas.
  {
    pinMode(col[i], OUTPUT);
  }
  for (int i = 0; i < 2; i++) //Declaración de los pines de las layers.
  {
    pinMode(lay[i], OUTPUT);
  }
}

void loop() //Orden de los efectos. LED incorporado en Arduino indica el cambio entre ellos.
{
  int btwfx = 10;
  digitalWrite(13, LOW);
  fx1();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx2();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx3();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx4();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx5();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx6();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx7();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx8();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx9();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx10();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx11();
  digitalWrite(13, HIGH);
  delay (btwfx);
  digitalWrite(13, LOW);
  fx12();
  digitalWrite(13, HIGH);
  delay (btwfx);
}

void fx1 ()
{
  int pov = 5;
  int dm = 0;
  digitalWrite (lay[0], HIGH); //Dimerizado on-off todo el cubo.
  digitalWrite (lay[1], HIGH);
  for (dm = 0; dm < 255; dm++)
  {
    analogWrite (col[0], dm);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  for (dm = 255; dm > 0; dm--)
  {
    analogWrite (col[0], dm);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  digitalWrite (lay[1], LOW);
  for (dm = 0; dm < 255; dm++) //Dimerizado on-off lay0.
  {
    analogWrite (col[0], dm);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  for (dm = 255; dm > 0; dm--)
  {
    analogWrite (col[0], dm);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  digitalWrite (lay[0], LOW);
  digitalWrite (lay[1], HIGH); //Dimerizado on-off lay1.
  for (dm = 0; dm < 255; dm++)
  {
    analogWrite (col[0], dm);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  for (dm = 255; dm > 0; dm--)
  {
    analogWrite (col[0], dm);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  digitalWrite (lay[1], LOW);
}

void fx2 ()
{
  int pov = 150;
  int cntfx = 0;
  for (cntfx = 0; cntfx < 4; cntfx++)
  {
    digitalWrite (lay[0], HIGH); //Eje X.
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[1], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[2], LOW);
    delay (pov);
    digitalWrite (col[0], HIGH); //Eje Y.
    digitalWrite (col[1], HIGH);
    digitalWrite (col[2], HIGH);
    digitalWrite (col[3], HIGH);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], LOW);
    delay (pov);
    digitalWrite (lay[0], HIGH); //Eje Z.
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    delay (pov);
  }
}

void fx3 ()
{
  int pov = 100;
  int cntfx = 0;
  for (cntfx = 0; cntfx < 4; cntfx++)
  {
    digitalWrite (lay[0], HIGH); //Vuelta on-off por lay0, desde col0 hasta col2.
    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    delay (pov);
    digitalWrite (col[1], LOW);
    delay (pov);
    digitalWrite (col[3], LOW);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (lay[1], HIGH); //Vuelta on-off por lay1, desde col0 hasta col2.
    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    delay (pov);
    digitalWrite (col[1], LOW);
    delay (pov);
    digitalWrite (col[3], LOW);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (lay[1], LOW);
    delay (pov);
    digitalWrite (lay[0], HIGH); //Vuelta on-off por lay0, desde col3 hasta col2.
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (col[3], LOW);
    delay (pov);
    digitalWrite (col[1], LOW);
    delay (pov);
    digitalWrite (col[0], LOW);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (lay[1], HIGH); //Vuelta on-off por lay1, desde col3 hasta col2.
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (col[3], LOW);
    delay (pov);
    digitalWrite (col[1], LOW);
    delay (pov);
    digitalWrite (col[0], LOW);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (lay[1], LOW);
    delay (pov);
  }
}

void fx4() //Rotación de una linea diagonal.
{
  int pov = 1;
  int cnt = 0;
  int cntfx = 0;
  for (cntfx = 0; cntfx < 10; cntfx++)
  {
    for (cnt = 0; cnt < 50; cnt++)
    {
      digitalWrite (lay[0], HIGH);
      digitalWrite (col[0], HIGH);
      delay (pov);
      digitalWrite (lay[0], LOW);
      digitalWrite (col[0], LOW);
      digitalWrite (lay[1], HIGH);
      digitalWrite (col[3], HIGH);
      delay (pov);
      digitalWrite (lay[1], LOW);
      digitalWrite (col[3], LOW);
    }
    for (cnt = 0; cnt < 50; cnt++)
    {
      digitalWrite (lay[0], HIGH);
      digitalWrite (col[1], HIGH);
      delay (pov);
      digitalWrite (lay[0], LOW);
      digitalWrite (col[1], LOW);
      digitalWrite (lay[1], HIGH);
      digitalWrite (col[2], HIGH);
      delay (pov);
      digitalWrite (lay[1], LOW);
      digitalWrite (col[2], LOW);
    }
    for (cnt = 0; cnt < 50; cnt++)
    {
      digitalWrite (lay[0], HIGH);
      digitalWrite (col[3], HIGH);
      delay (pov);
      digitalWrite (lay[0], LOW);
      digitalWrite (col[3], LOW);
      digitalWrite (lay[1], HIGH);
      digitalWrite (col[0], HIGH);
      delay (pov);
      digitalWrite (lay[1], LOW);
      digitalWrite (col[0], LOW);
    }
    for (cnt = 0; cnt < 50; cnt++)
    {
      digitalWrite (lay[0], HIGH);
      digitalWrite (col[2], HIGH);
      delay (pov);
      digitalWrite (lay[0], LOW);
      digitalWrite (col[2], LOW);
      digitalWrite (lay[1], HIGH);
      digitalWrite (col[1], HIGH);
      delay (pov);
      digitalWrite (lay[1], LOW);
      digitalWrite (col[1], LOW);
    }
  }
}

void fx5()
{
  int pov = 100;
  int cntfx = 0;
  for (cntfx = 0; cntfx < 5; cntfx++)
  {
    digitalWrite (col[0], HIGH); //Lluvia en col0.
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (col[3], HIGH); //Lluvia en col3.
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (col[3], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (col[1], HIGH); //Lluvia en col1.
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (col[2], HIGH); //Lluvia en col2.
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (col[0], HIGH); //Lluvia en col0 y col3.
    digitalWrite (col[3], HIGH);
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (col[1], HIGH); //Lluvia en col1 y col2.
    digitalWrite (col[2], HIGH);
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (lay[0], LOW);
    delay (pov);
  }
}

void fx6()
{
  int pov = 100;
  int cntfx = 0;
  for (cntfx = 0; cntfx < 8; cntfx++)
  {
    digitalWrite (lay[0], HIGH); //LED corriendo por lay0, antihorario.
    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[3], LOW);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (lay[1], HIGH); //LED corriendo por lay1, horario.
    digitalWrite (lay[0], LOW);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[3], LOW);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (lay[1], LOW);
  }
}

void fx7()
{
  int pov = 500;
  for (pov = 500; pov > 20; pov -= 20) //Titileo del cubo acelerando.
  {
    digitalWrite (lay[0], HIGH);
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[1], HIGH);
    digitalWrite (col[2], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], LOW);
    delay (pov);
  }
  for (pov = 20; pov < 500; pov += 20) //Titileo del cubo decelerando.
  {
    digitalWrite (lay[0], HIGH);
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[1], HIGH);
    digitalWrite (col[2], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], LOW);
    delay (pov);
  }
}

void fx8()
{
  int pov = 100;
  int cntfx = 0;
  for (cntfx = 0; cntfx < 10; cntfx++)
  {
    digitalWrite (lay[0], HIGH); //Plano diagonal de derecha-adelante a izquierda-fondo
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (col[2], LOW);
    delay (pov * 2);
    digitalWrite (col[3], HIGH); //Plano diagonal de derecha-fondo a izquierda-adelante
    delay (pov);
    digitalWrite (col[3], LOW);
    digitalWrite (col[2], HIGH);
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (col[2], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    delay (pov * 2);
  }
}

void fx9() //Encendido total y apagado lento.
{
  digitalWrite (lay[0], HIGH);
  digitalWrite (lay[1], HIGH);
  digitalWrite (col[0], HIGH);
  digitalWrite (col[1], HIGH);
  digitalWrite (col[2], HIGH);
  digitalWrite (col[3], HIGH);
  int dm = 255;
  int cntfx = 0;
  int pov = 10;
  for (cntfx = 0; cntfx < 4; cntfx++)
  {
    for (dm = 255; dm > 0; dm--)
    {
      analogWrite (col[0], dm);
      analogWrite (col[1], dm);
      analogWrite (col[2], dm);
      analogWrite (col[3], dm);
      delay (pov);
    }
  }
  digitalWrite (lay[0], LOW);
  digitalWrite (lay[1], LOW);
}

void fx10() //Giro horario al frente, antihorario al fondo.
{
  int pov = 150;
  int cntfx = 0;
  for (cntfx = 0; cntfx < 20; cntfx++)
  {
    digitalWrite (lay[0], HIGH);
    digitalWrite (col[1], HIGH);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (col[1], HIGH);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);

  }
  digitalWrite (col[1], LOW);
  digitalWrite (col[2], LOW);
}

void fx11() //Dimerizado on de a dos LED´s en diagonales opuestas. Dimerizado off al completarse
{
  int dm = 0;
  int pov = 12;
  for (dm = 0; dm < 255; dm++)
  {
    digitalWrite (lay[1], HIGH);
    analogWrite (col[0], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  for (dm = 0; dm < 255; dm++)
  {
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (lay[0], HIGH);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    delay (pov / 2);
    digitalWrite (lay[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov / 2);
  }
  for (dm = 0 ; dm < 255; dm++)
  {
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (lay[0], HIGH);
    analogWrite (col[0], dm);
    analogWrite (col[3], dm);
    delay (pov / 3);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov / 3);
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (lay[0], HIGH);
    digitalWrite (col[1], HIGH);
    digitalWrite (col[2], HIGH);
    delay (pov / 3);
  }
  for (dm = 0 ; dm < 255; dm++)
  {
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (lay[1], HIGH);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    delay (pov / 3);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[1], HIGH);
    digitalWrite (col[2], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov / 3);
    digitalWrite (lay[0], LOW);
    digitalWrite (col[0], LOW);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], LOW);
    digitalWrite (col[3], LOW);
    digitalWrite (lay[1], HIGH);
    digitalWrite (col[0], HIGH);
    digitalWrite (col[3], HIGH);
    delay (pov / 3);
  }
  digitalWrite (lay[0], HIGH);
  for (dm = 255; dm > 0; dm--)
  {
    analogWrite (col[0], dm);
    analogWrite (col[1], dm);
    analogWrite (col[2], dm);
    analogWrite (col[3], dm);
    delay (pov);
  }
  digitalWrite (lay[1], LOW);
  digitalWrite (lay[0], LOW);
  digitalWrite (col[0], LOW);
  digitalWrite (col[1], LOW);
  digitalWrite (col[2], LOW);
  digitalWrite (col[3], LOW);
}

void fx12() //Aparece un LED, salta a su esquina opuesta y desaparece.
{
  int pov = 100;
  int dm = 0;
  int cntfx = 0;
  digitalWrite (lay[0], HIGH);
  for (cntfx = 0; cntfx < 10; cntfx++)
  {
    for (dm = 0; dm < 255; dm++)
    {
      analogWrite (col[0], dm);
      delay (5);
    }

    digitalWrite (col[0], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (col[0], LOW);
    digitalWrite (col[3], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    for (dm = 255; dm > 0; dm--)
    {
      analogWrite (col[3], dm);
      delay (5);
    }
    digitalWrite (col[3], LOW);
    for (dm = 0; dm < 255; dm++)
    {
      analogWrite (col[1], dm);
      delay (5);
    }
    digitalWrite (col[1], HIGH);
    delay (pov);
    digitalWrite (lay[0], LOW);
    digitalWrite (lay[1], HIGH);
    delay (pov);
    digitalWrite (col[1], LOW);
    digitalWrite (col[2], HIGH);
    delay (pov);
    digitalWrite (lay[1], LOW);
    digitalWrite (lay[0], HIGH);
    delay (pov);
    for (dm = 255; dm > 0; dm--)
    {
      analogWrite (col[2], dm);
      delay (5);
    }
    digitalWrite (col[2], LOW);
  }
  digitalWrite (lay[0], LOW);
}
Agradezco a Darkbytes por la enseñanza, y sigo su consejo: El cubo consta de ocho LED´s dispuestos en cuatro columnas de dos cada una, con los ánodos comunes a toda la columna. Los cátodos se unen entre ellos para formar los "pisos" (eje Y), los cuáles constan de cuatro LED´s cada uno. Estos "pisos" están transistorizados para habilitar o no dicho "piso". Estos transistores son dirigidos desde los pines 2 y 4 del Arduino con una resistencia de 15KOmhs en serie con la base de cada transistor. Los colectores se conectan con los "pisos" y los emisores a GND. Desde los pines 10, 9 , 5 y 6 del Arduino se controla cada una de las columnas mediante una resistencia de 220Omhs en serie con cada una. Esto en cuanto al hardware, pero como leí por ahí: un cubo LED solo es tan atractivo como el software que corre. Adjunto esquema, foto ilustrativa y archivo de Livewire y código en formato .ino en el archivo .zip . Gracias a toda la comunidad. Si hay consultas estoy atento. Saludos.
 

Adjuntos

Última edición:
#2
Estaría bueno si pudieras subir un pequeño videoito, así se apreciaría mejor tu aporte para que otro lo pueda ver.
 
#3
Estimado tocayo juanma2468: me encantaría dejarles un video, pero mi internet es EXCESIVAMENTE lenta, nunca lograría subirlo:cry: La mejor sugerencia que puedo hacer es que lo armen y lo prueben. Es sencillo y vale la pena.:) Me comprometo a ir incluyendo más animaciones, si así lo desean. A fin de cuentas, estoy tratando de explotar esto al máximo para cuando pase a la próxima base: 3^3:cool: Abrazos a toda la comunidad.
 
#8
Bueno... Perdón por dejar medio colgado el hilo. No logre ni siquiera VER cómo se hacia el gif (así de lenta es mi internet).

Continuando con el tema: hice algunas mejoras al circuito y al programa y quiero compartirlas con la comunidad.

Incorpore dos pulsadores: uno permite elegir el modo "Automático" donde los efectos se suceden uno tras otro, o el modo "Manual" donde un solo efecto quede aconteciendo, hasta que se presione el segundo interruptor y se pase al próximo efecto.

Dentro de poco comenzaré con la construcción de un 4 al cubo, aprovechando dos latches 74hc373 que logré conseguir en una odisea de investigación de datasheets y visitas a las casas de electrónica de Bariloche.

Abrazos a toda la comunidad!:)
 

Adjuntos

Temas similares

Arriba