Paso 6: programación
Copie y pegue todo en la ventana de arduino pero no modificarla a menos que usted
tienen experiencia en programación de arduino!
#include < avr/pgmspace.h > / / permite el uso de PROGMEM para almacenar patrones de flash
#define CUBESIZE 4
#define PLANESIZE CUBESIZE * CUBESIZE
#define PLANETIME 3333 / / tiempo de cada plano se muestra en nosotros -> refresco de 100 Hz
#define TIMECONST 20 / / multiplica DisplayTime para obtener ms - = ¿por qué no 100?
Tabla de patrón de LED en PROGMEM - la última columna es tiempo de visualización en unidades de 100ms
TODO esto podría ser mucho más compacto, pero no con la representación del patrón binario
prog_uchar PROGMEM PatternTable [] = {}
parpadea el encendido y apagado
B0001 B0000 B0000, B0000, B0001, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0011 B0000 B0000, B0000, B0011, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0011 B0010, B0000, B0000, B0011, B0010, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0011 B0011 B0000, B0000, B0011, B0011, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0110 B0110 B0000, B0000, B0110, B0110, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0110, B0110, B0000, B0000, B0110, B0110, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0110, B0110, B0000, B0000, B0110, B0110, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0110, B0110, B0000, B0000, B0110, B0110, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0011, B0011, B0000, B0000, B0011, B0011, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0001, B0011, B0111, B0000, B0001, B0011, B0111, B0000, B0000, B0001, B0011, 10,
B0000 B0000 B0000, B0000, B0000, B0011, B0111, B0111, B0000, B0011, B0111, B0111, B0000, B0001, B0011, B0111, 10,
B0000 B0000 B0000, B0000, B0000, B0111, B0111, B0111, B0000, B0111, B0111, B0111, B0000, B0011, B0111, B0111, 10,
B0000 B0000 B0000, B0000, B0000, B0111, B0111, B0111, B0000, B0111, B0111, B0111, B0000, B0111, B0111, B0111, 10,
B0000 B0000 B0000, B0000, B0000, B1110, B1110, B1110, B0000, B1110, B1110, B1110, B0000, B1110, B1110, B1110, 10,
B0000 B1110, B1110, B1110, B0000, B1110, B1110, B1110, B0000, B1110, B1110, B1110, B0000, B0000, B0000, B0000, 10,
B0000 B1110, B1110, B1110, B0000, B1110, B1110, B1110, B0000, B1100, B1110, B1110, B0000, B0000, B0000, B0000, 10,
B0000 B1110, B1110, B1110, B0000, B1100, B1110, B1110, B0000, B1000, B1100, B1110, B0000, B0000, B0000, B0000, 10,
B0000 B1100, B1110, B1110, B0000, B1000, B1100, B1110, B0000, B0000, B1000, B1100, B0000, B0000, B0000, B0000, 10,
B0000 B1000, B1100, B1110, B0000, B0000, B1000, B1100, B0000, B0000, B0000, B1000, B0000, B0000, B0000, B0000, 10,
B0000 B0000, B1000, B1100, B0000, B0000, B0000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000, B1000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B1000 B1000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1000 B1000 B1000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1100 B1000 B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1110, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1110 B0000 B0000, B0000, B0010, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0110 B0000 B0000, B0000, B0011, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0010 B0000 B0000, B0000, B0011, B0001, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0011, B0001, B0001, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0001, B0001, B0001, B0001, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0001, B0001, B0011, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0001, B0111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B1111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B1110, B0000, B0000, B0000, B1000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B1100, B0000, B0000, B1000, B1000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B1000, B0000, B0000, B1100, B1000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1110, B1000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1111, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0001, B0111, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0001, B0001, B0011, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0001, B0001, B0001, B0000, B0001, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0001, B0001, B0000, B0000, B0011, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0111, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1111, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1110, B1000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1100, B1100, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1000, B1110, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1111, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0111, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0011, B0000, B0000, 10,
B0000 B0001, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0001, B0000, B0000, 10,
B0001 B0001, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0011 B0001, B0000, B0000, B0000, B0001, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0111 B0001, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1100, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1110, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B0001, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B0011, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B0111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1100, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1110, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0111 B0111 B0111, B0111, B1000, B1000, B1000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0011 B0011 B0011, B0011, B0100, B0100, B0100, B0100, B1000, B1000, B1000, B1000, B0000, B0000, B0000, B0000, 10,
B0001 B0001, B0001, B0001, B0010, B0010, B0010, B0010, B0100, B0100, B0100, B0100, B1000, B1000, B1000, B1000, 10,
B0001 B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0010, B0010, B0010, B0010, B0100, B0100, B0100, B0100, 10,
B0001 B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0010, B0010, B0010, B0010, 10,
B0001 B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, B0001, 10,
B0010 B0001, B0001, B0001, B0010, B0001, B0001, B0001, B0010, B0001, B0001, B0001, B0010, B0001, B0001, B0001, 10,
B0100 B0010, B0001, B0001, B0100, B0010, B0001, B0001, B0100, B0010, B0001, B0001, B0100, B0010, B0001, B0001, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0010 B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, 10,
B0100 B0100 B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0010 B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, 10,
B0100 B0100 B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0010 B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, 10,
B0100 B0100 B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0010 B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, 10,
B0100 B0100 B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0010 B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, 10,
B0100 B0100 B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0010 B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, 10,
B0100 B0100 B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, B0100, B0100, B0010, B0010, 10,
B1000 B0100 B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, B1000, B0100, B0010, B0001, 10,
B0000 B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, B0000, B1100, B0011, B0000, 10,
B0000 B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, B0000, B0011, B1100, B0000, 10,
B0001 B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0000 B0010, B0100, B0000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0000 B0000 B0000, B0000, B0000, B0010, B0100, B0000, B0001, B0010, B0100, B1000, B0001, B0010, B0100, B1000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0010, B0100, B0000, B0001, B0010, B0100, B1000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0010, B0100, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B1000, B0000, B0010, B0000, B1000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B1000, B0000, B0010, B0000, B1000, B0000, B0010, B1000, B0000, 10,
B0000 B0000 B0000, B1000, B0000, B0010, B0000, B1000, B0000, B0010, B1000, B0000, B0000, B0000, B1000, B0000, 10,
B0000 B0010, B0000, B1000, B0000, B0010, B1000, B0000, B0000, B0000, B1000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0010, B1000, B0000, B0000, B0000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000, B1000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0100 B0010, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0110 B0110, B0000, B0000, B0100, B0010, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1001 B0110 B0110, B1001, B0000, B0110, B0110, B0000, B0000, B0100, B0010, B0000, B0000, B0000, B0000, B0000, 10,
B1101 B0111, B1110, B1011, B1001, B0110, B0110, B1001, B0000, B0110, B0110, B0000, B0000, B0100, B0010, B0000, 10,
B1111 B1111 B1111, B1111, B1101, B0111, B1110, B1011, B1001, B0110, B0110, B1001, B0000, B0110, B0110, B0000, 10,
B1111 B1111 B1111, B1111, B1111, B1111, B1111, B1111, B1101, B0111, B1110, B1011, B1001, B0110, B0110, B1001, 10,
B1111 B1111 B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1101, B0111, B1110, B1011, 10,
B1111 B1111 B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, 10,
B1111 B1111 B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1111, B1111, B1111, B1111, B1111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B1111 B1111 B1111, B1111, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 10,
se trata de un elemento ficticio para el final de la tabla (duración = 0) aka!!! ¡ NO TOQUE!
B0000 B0000 B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 0
};
/*
** Definición de pines de matriz facilita cambiar cómo se cablea el cubo
** Ajustar números aquí hasta que parpadean en orden - L a R, T a B
** Nota que entradas analógicas 0-5 también son salidas digitales 14-19.
** Pin DigitalOut0 (serial RX) y AnalogIn5 se dejan abierta para futuras aplicaciones
*/
int LEDPin [] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
int [] PlanePin = {16, 17, 18, 19};
inicialización de
void setup()
{
int pin; contador de bucle
configura pines del LED como salida (activo alto)
para (pin = 0; pin < PLANESIZE; pin ++) {}
pinMode (LEDPin [pin], salida);
}
configurar pines plano como salidas (activo bajo)
para (pin = 0; pin < CUBESIZE; pin ++) {}
pinMode (PlanePin [pin], salida);
}
}
muestra patrón en mesa hasta DisplayTime es cero (y repetir)
void loop()
{
declarar variables
byte PatternBuf [PLANESIZE]; guarda el patrón actual de PatternTable
int PatternIdx;
byte DisplayTime; tiempo * 100ms para mostrar configuración
EndTime largo sin firmar;
plano de int. contador de bucle para actualización de cubo
int patbufidx; índices que byte del buffer patrón
int ledrow; cuenta con LEDs en bucle de actualización
int ledcol; cuenta con LEDs en bucle de actualización
int ledpin; cuenta con LEDs en bucle de actualización
Inicializar PatternIdx al principio de la tabla patrón
PatternIdx = 0;
lazo sobre las entradas de tabla de patrón - mientras DisplayTime > 0
{}
Lee el patrón de PROGMEM y guardar en array
memcpy_P (PatternBuf, PatternTable + PatternIdx, PLANESIZE);
PatternIdx += PLANESIZE;
leer DisplayTime del índice PROGMEM y el incremento de
DisplayTime = pgm_read_byte_near (PatternTable + PatternIdx ++);
calcular EndTime del actual tiempo (ms) y DisplayTime
EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;
bucle mientras DisplayTime > tiempo 0 y actual < EndTime
mientras que (millis() < EndTime) {}
patbufidx = 0; reiniciar contador de índice al principio del buffer
lazo sobre planos
para (plano = 0; plano < CUBESIZE; plano ++) {}
Apague el plano anterior
Si (plano == 0) {}
digitalWrite (PlanePin [CUBESIZE-1], alto);
} else {}
digitalWrite (PlanePin [plano-1], alto);
}
datos actuales de patrón plano de carga en puertos
ledPin = 0;
para (ledrow = 0; ledrow < CUBESIZE; ledrow ++) {}
para (ledcol = 0; ledcol < CUBESIZE; ledcol ++) {}
digitalWrite (LEDPin [ledpin ++], PatternBuf [patbufidx] & (1 << ledcol));
}
patbufidx ++;
}
encender el avión actual
digitalWrite (PlanePin [avión], LOW);
retrasar PLANETIME nos
delayMicroseconds (PLANETIME);
} / / avión
} / / mientras < EndTime
} mientras (DisplayTime > 0); leer patrones hasta el momento = 0 que indica el final
}