3x3x3 Led Cube

Here is a Video of my first Arduino Project.

It’s a 3x3x3 Led Cube (It’s working almost at perfection)

You can download a “DataSheet” with a guide to make your own cube. Sorry if it’s not perfect, help me once you read it to know what else I should explain so we can make the guide better.

I know the control of the floors needs to be improved, but at least it’s working now as it is designed.

You can download the PDF from any of this links.

http://ul.to/1ea3e9qp

http://depositfiles.org/files/l4d9elvoa

http://www.mediafire.com/?9e5vx293bt2bbbi

The idea is to add more step by step construction info in this blog, but this is a point to start.

As an example, this is the schematic on the pdf, which contains a lot more information.

Led Cube PDF

The code is really basic and can be improved for better programming in 1000 of ways. But it’s a start. I think this is how monkeys does codes.

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
int Piso1 = 2;
int Piso2 = 3;
int Piso3 = 4;

int i=0;
int pausa = 100;
int tempo = 5000;

void setup() {
pinMode(latchPin, OUTPUT);pinMode(clockPin, OUTPUT);pinMode(dataPin, OUTPUT);
pinMode(Piso1, OUTPUT);pinMode(Piso2, OUTPUT);pinMode(Piso3, OUTPUT);
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH);delay(200);digitalWrite(13, LOW);delay(200);
////**** VIBORITA(tempo,veces) ****////
VIBORITA(50,5);

////**** CAIDA(tempo,veces) ****////
CAIDA(100,3);

////**** DE_A_TRES(tempo,veces) ****////
DE_A_TRES(150,3);

////**** TRES_ON(tempo,veces) ****////
TRES_ON(250,3);
TRES_ON(100,3);

////**** RELOJ(tempo,veces,piso) ****////

RELOJ(50,5,1);RELOJ(40,7,2);RELOJ(30,10,4);RELOJ(50,5,2);RELOJ(40,7,1);RELOJ(30,10,2);RELOJ(50,5,4);RELOJ(40,7,2);RELOJ(30,10,1);
RELOJ(50,5,7);RELOJ(40,7,7);RELOJ(30,10,7);

RELOJK(50,5,1);RELOJK(40,7,2);RELOJK(30,10,4);RELOJK(50,5,2);RELOJK(40,7,1);RELOJK(30,10,2);RELOJK(50,5,4);RELOJK(40,7,2);RELOJK(30,10,1);

PARED(400,5);

UNO_DI(250,1);UNO_DI(200,1);UNO_DI(150,1);UNO_DI(100,1);UNO_DI(50,1);UNO_DI(25,5);
UNO_DI(25,5);UNO_DI(50,4);UNO_DI(100,3);UNO_DI(150,2);UNO_DI(200,1);UNO_DI(250,1);UNO_DI(300,1);UNO_DI(350,1);UNO_DI(400,1);UNO_DI(450,1);UNO_DI(500,1);

APAGAR();
delay(1000);
}

void VIBORITA(int tempo,int veces) {
//In to the cube
//Paso 1
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 2
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 3
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}

//Loop times
for (i=1;i<=veces;i++) {
//Paso 4
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 5
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 6
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 7
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 8
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 9
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 10
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 11
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 12
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 13
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 14
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 15
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 16
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 17
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 18
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 19
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 20
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 21
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 22
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 23
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 24
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 25
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 27
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 28
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 29
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 30
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 31
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 32
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
}//Fin VIBORITA Veces
//Out of cube
//Paso 33
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 34
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 35
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//Paso 36
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
}//Fin VIBORITA

void CAIDA(int tempo,int veces) {
for (i=1;i<=veces;i++) {

//PASO 1
for (int j=1;j<=250;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 2
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 3
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 4
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 5
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 6
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 7
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 8
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 9
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 10
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 11
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 12
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 13
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 14
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 15
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 16
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 17
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 18
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 19
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 20
for (int j=1;j<=200;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
}
//PASO 21
for (int j=1;j<=200;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}
}
}

void RELOJ(int tempo, int veces,int piso){
for(int i=0;i<=veces;i++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);
}//Fin for RELOJ

}//Fin RELOJ

void RELOJK(int tempo, int veces,char piso){
for(int i=0;i<=veces;i++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 6);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, piso);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 3);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);
}//Fin for RELOJK

}//Fin RELOJK

void UNO_DI(int tempo, int veces) {
for (i=1;i<=veces;i++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);
}
}

void TRES_ON(int tempo,int veces) {
for (i=1;i<=veces;i++) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Piso 1 = 1 // Piso 2 = 2 // Piso 3 = 4
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);
}//Fin for TRES_ON
}//Fin TRES_ON

void APAGAR(){
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);
}

void PARED(int tempo, int veces){
for(int i=0;i<=veces;i++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 7);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 0);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 1);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 4);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 7);
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Atras
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Medio
shiftOut(dataPin, clockPin, MSBFIRST, 2);//Adelante
digitalWrite(latchPin, HIGH);delay(tempo);

}//Fin for PARED

}//Fin PARED

void DE_A_TRES(int tempo,int veces) {
for (i=1;i<=veces;i++) {

//PASO 1
for (int j=1;j<=500;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
}

//PASO 2
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 5);digitalWrite(latchPin, HIGH);delay(1);
}

//PASO 3
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
}

//PASO 4
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 6);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}

//PASO 5
for (int j=1;j<=500;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);shiftOut(dataPin, clockPin, MSBFIRST, 7);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}

//PASO 6
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 3);shiftOut(dataPin, clockPin, MSBFIRST, 5);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
}

//PASO 7
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 4);shiftOut(dataPin, clockPin, MSBFIRST, 2);digitalWrite(latchPin, HIGH);delay(1);
}

//PASO 8
for (int j=1;j<=tempo;j++) {
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 4);
shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);shiftOut(dataPin, clockPin, MSBFIRST, 0);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 2);
shiftOut(dataPin, clockPin, MSBFIRST, 2);shiftOut(dataPin, clockPin, MSBFIRST, 1);shiftOut(dataPin, clockPin, MSBFIRST, 4);digitalWrite(latchPin, HIGH);delay(1);
digitalWrite(latchPin, LOW);shiftOut(dataPin, clockPin, MSBFIRST, 1);
shiftOut(dataPin, clockPin, MSBFIRST, 5);shiftOut(dataPin, clockPin, MSBFIRST, 6);shiftOut(dataPin, clockPin, MSBFIRST, 3);digitalWrite(latchPin, HIGH);delay(1);
}

}
}

Next step is writing a function for the ShiftOut and perhaps using a faster method.

5 thoughts on “3x3x3 Led Cube

  1. Jay

    A very comprehensive guide.. The breadboard layout is art.. PDF, video and code… Many will learn from this.. Great job

    Reply
    1. American Post author

      Thanks, it’s not a perfect circuit, but for a 3x3x3 and 5V it will work ok.

      I’m working on a better code, then I will post it.

      I’m glad you liked the Breadboard ;)

      Reply
  2. Peter Newman

    Hi I saw your cube on the Arduino forum. I have made a 3 x 3 x 3 cube using nine Arduino pins for the columns and three 2N2222 transistors for the level switching. I have also played around a fair bit with 74HC595 shift registers and have been trying to come up with a design for a 4 x 4 x 4 cube using these SR. I would love to download the PDF of your cube to get some ideas but the site where you have them hosted is a pay site. Is there any way that you might be able to provide me with a free link to your PDF. Thank you Pedro.

    Reply
    1. Peter Newman

      Hi again, I was a bit quick to contact you regarding a different link as I have managed to download your PDF. Thanks for sharing and I will post any successes that I have on the Arduino forum Pedro.

      Reply
    2. American Post author

      Uploading it again and to another host also.

      Thanks for the interest, please if you have some improvement for the project, share with us.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>