A place to put your YouTube video that is ESP8266 related.

User avatar
By vinorasu
#35058 greetings ,
my first post here and first try at POV



RX and TX used as gpio this gives 3 output for the 74hc595 and one input for the infrared sensor,
this last one fires the interrupt that makes the animation start over.

I could have done it RGB if I hadnt reverse connect the ws2812, then the magic smoke came
Best Regards
User avatar
By RichardS
#35078 Very cool thanks for the post!

Maybe blog about it for us? :-)

Richard.
User avatar
By vinorasu
#36002 hi , here is the code I hope it helps somebody. the code it's a shame im not a programmer by trade ,use as you wish

, sorry its with spanish comments and variable names ,but you get the idea.
the font I got it from http://www.andrewhazelden.com/blog/2010 ... -display/#
the shiftout function comes from arduino examples



Code: Select all//**************************************************************//
//envia letras al POV con esp8266

//**************************************************************//

//Pin connected to ST_CP of 74HC595
int latchPin = 2;     //
//Pin connected to SH_CP of 74HC595
int clockPin = 0;   //nodemcu pin 6   -12
////Pin connected to DS of 74HC595
int dataPin = 1;   //nodemcu pin 7   -13



int OptocouplerPin = 3;   //it is the RX pin in esp01   


volatile int CONTADOR_DE_VUELTAS=0;
volatile boolean NUEVA_VUELTA=1;
volatile long microsec=1;
volatile long last_microsec=1;
volatile long tiempovuelta=1;  //en microsegundos, para delays etc
volatile long espacio_entre_chars=100; // Y ESPACIO ENTRE LINEAS DE CADA CHAR

int vueltas_por_animacion=50;


void setup() {
   //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
   pinMode(clockPin, OUTPUT);
    pinMode(dataPin, OUTPUT);
 attachInterrupt(OptocouplerPin, INTERRUPT_INICIO_ANIMACION, FALLING); //CUANDO EL OPTOCOUPLER PASE POR LA MUESCA, EMPIEZA LA ANIMACION

}



 //8 pixels high x 7 pixels wide letters

const char letter_SPC[8]= {0,0,0,0,0,0,0};
const char letter_newline[8]= {0,0,0,0,0,0,0};
const char letter_A[8]= {31,36,68,132,68,36,31};
const char letter_B[8]= {255,137,137,137,137,137,118};
const char letter_C[8]= {126,129,129,129,129,129,66};
const char letter_D[8]= {255,129,129,129,129,70,60};
const char letter_E[8]= {255,137,137,137,129,129,129};
const char letter_F[8]= {255,136,136,136,136,128,128};
const char letter_G[8]= {126,129,129,137,137,143,72};
const char letter_H[8]= {255,8,8,8,8,8,255};
const char letter_I[8]= {129,129,129,255,129,129,129};
const char letter_J[8]= {142,129,129,254,128,128,128};
const char letter_K[8]= {255,16,16,16,40,68,131};
const char letter_L[8]= {255,1,1,1,1,1,1};
const char letter_M[8]= {255,128,128,112,128,128,255};
const char letter_N[8]= {255,64,32,16,8,4,255};
const char letter_O[8]= {126,129,129,129,129,129,126};
const char letter_P[8]= {255,136,136,136,136,136,112};
const char letter_Q[8]= {124,130,138,134,131,130,124};
const char letter_R[8]= {255,136,136,136,140,138,113};
const char letter_S[8]= {98,145,145,145,137,137,70};
const char letter_T[8]= {128,128,128,255,128,128,128};
const char letter_U[8]= {255,1,1,1,1,1,255};
const char letter_V[8]= {248,4,2,1,2,4,248};
const char letter_W[8]= {254,1,1,14,1,1,254};
const char letter_X[8]= {129,2,36,24,36,66,129};
const char letter_Y[8]= {128,0,32,31,32,64,128};
const char letter_Z[8]= {131,133,137,145,161,193,129};
const char letter_0[8]= {0,126,133,137,145,161,126};
const char letter_1[8]= {0,33,65,255,1,1,0};
const char letter_2[8]= {65,131,133,137,137,145,99};
const char letter_3[8]= {66,129,129,137,137,149,98};
const char letter_4[8]= {0,12,20,36,68,255,4};
const char letter_5[8]= {121,137,137,137,137,137,134};
const char letter_6[8]= {126,137,137,137,137,137,134};
const char letter_7[8]= {128,128,128,143,144,160,192};
const char letter_8[8]= {118,137,137,129,137,137,118};
const char letter_9[8]= {112,137,137,129,137,137,126};
const char letter_PERIOD[8]= {0,0,0,15,7,0,0};
const char letter_COMMA[8]= {0,0,0,6,7,0,0};
const char letter_QUOTE[8]= {0,120,120,0,120,120,0};
const char letter_SINGLE_QUOTE[8]= {0,0,0,120,120,0,0};
const char letter_QUESTION[8]= {0,96,128,141,144,144,96};
const char letter_EXCLAIM[8]= {0,0,0,253,0,0,0};
const char letter_AT[8]= {0,126,153,165,165,153,120};
const char letter_NUM[8]= {36,255,36,36,36,255,36};
const char letter_DOLLAR[8]= {36,82,82,255,74,74,36};
const char letter_PERCENT[8]= {65,162,68,24,34,69,130};
const char letter_CARRAT[8]= {12,48,64,128,64,48,12};
const char letter_AMPERSAND[8]= {67,163,149,137,141,147,114};
const char letter_ASTERISK[8]= {201,42,28,255,28,42,201};
const char letter_LEFT_PAREN[8]= {0,0,0,126,129,0,0};
const char letter_RIGHT_PAREN[8]= {0,0,129,126,0,0,0};
const char letter_DASH[8]= {8,8,8,8,8,8,8};
const char letter_UNDERSCORE[8]= {1,1,1,1,1,1,1};
const char letter_PLUS[8]= {8,8,8,255,8,8,8};
const char letter_EQUALS[8]= {36,36,36,36,36,36,36};
const char letter_TILDE[8]= {16,48,32,32,16,48,32};
const char letter_TICK[8]= {0,0,96,112,0,0,0};
const char letter_COLON[8]= {0,0,102,102,0,0,0};
const char letter_SEMICOLON[8]= {0,0,102,103,0,0,0};
const char letter_BACK_SLASH[8]= {1,2,4,24,32,64,128};
const char letter_FORWARD_SLASH[8]= {128,64,32,24,4,2,1};
const char letter_LEFT_CHEVRON[8]= {0,36,66,129,0,0,0};
const char letter_RIGHT_CHEVRON[8]= {0,129,66,38,24,24,0};
const char letter_TAB[8]= { 255,255,255,255,255,255,255};  // The tab character makes a solid block.
const char letter_LEFT_BRACKET[8]= {0,0,0,255,129,129,0};
const char letter_RIGHT_BRACKET[8]= {0,129,129,255,0,0,0};
const char letter_SMILIE[8]= {126,137,165,133,165,137,126};
const char letter_HEART[8]= {120,252,126,63,126,252,120};   
const char letter_DEGREE[8] = {0,48,72,64,48,0,0};         
const char letter_CENTS[8] = {0,60,66,255,66,36,0};         
const char letter_EURO[8] = {20,126,149,149,129,66,0};     
const char letter_PILCROW[8] = {0,48,120,255,128,255,0};   
const char letter_BULLET[8] = {0,60,126,126,126,60,0};     
 
//8x18 icons
const char icon_SPC[19]= {255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255};       //blank icon
const char icon_MOUNTAINS[19]= {1,1,3,7,15,31,63,127,255,255,127,63,31,15,7,3,1,1}; //mountain range icon
const char icon_INVERTED_MOUNTAINS[19]= {254,254,252,248,240,224,192,128,0,0,128,192,224,240,248,252,254,254}; //inverted mountains
const char icon_CHECKER[19]= {170,85,170,85,170,85,170,85,170,85,170,85,170,85,170,85,170,85}; // fine checker pattern
const char icon_BLOCK[19]= {0,255,255,195,195,195,195,195,195,195,195,195,195,195,195,255,255,0};     //Hollow block icon
const char icon_SMILEY[19]= {0,0,126,129,129,137,133,165,133,133,133,165,133,137,129,129,126,0};     //smiley icon
const char icon_GREEK[19]= {2,254,128,128,158,146,146,242,2,2,254,128,128,158,146,146,242,2};     //Greek Pattern
const char icon_HELICAL[19]= {195,195,192,224,96,112,56,28,15,199,192,192,192,192,224,104,124,62}; //helical pattern
const char icon_INVERTED_HELICAL[19]= {60,60,63,31,159,143,199,227,241,56,60,63,63,63,31,151,131,193}; // inverted helical pattern
 

byte espiral_data[]={B00000001,B00000010,B00000100,B00001000,B00010000,B00100000,B01000000,B10000000};
byte doble_espiral_data[]={B00000011,B00000110,B00001100,B00011000,B00110000,B01100000,B11000000,B11111111};
byte rampa_data[]={B00000001,B00000011,B00000111,B00001111,B00011111,B00111111,B01111111,B11111111};


byte INVERT_rampa_data[]={B10000000,B11000000,B11100000,B11110000,B11111000,B11111100,B11111110,B11111111};

byte circulos_data[]={B10011001,B10011001,B10011001,B10011001,B10011001,B10011001,B10011001,B10011001};


byte aleatorio_data[]={random(0,255),random(0,255),random(0,255),random(0,255),random(0,255),random(0,255),random(0,255),random(0,255)};
void loop() {
 
 
  if (NUEVA_VUELTA==1){  //ha empezado otra vuelta
       NUEVA_VUELTA=0;  //RESETEA EL VALOR STATUS  PARA QUE DETECTE SI HA EMPEZADO OTRA VUELTA ANTES DE ACABAR LA ANIMACION
        tiempovuelta=microsec -last_microsec; // AQUI AJUSTA CUANTO TARDA EN HACER UNA VUELTA , EN MICROSEGUNDOS
   
   
   
   
    if  (CONTADOR_DE_VUELTAS> 0 && CONTADOR_DE_VUELTAS< vueltas_por_animacion){   

   
  imprime_caracter(letter_V);
  imprime_caracter(letter_O);   
  imprime_caracter(letter_P);
   
  imprime_caracter(letter_SPC);
  imprime_caracter(letter_6);
  imprime_caracter(letter_6);   
  imprime_caracter(letter_2);
  imprime_caracter(letter_8);
  imprime_caracter(letter_P);
  imprime_caracter(letter_S);
  imprime_caracter(letter_E);
    }
   
   
    if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*2){ 
    circulos();
    }
       



    if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*2  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*3){ 
  primera_caracters();
 
  }
 
 
 
 
 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*3  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*4){   

  imprime_caracter(letter_SMILIE);
  imprime_caracter(letter_SPC);
  imprime_caracter(letter_N);
  imprime_caracter(letter_I);   
  imprime_caracter(letter_L);
  imprime_caracter(letter_U);   
  imprime_caracter(letter_R);
  imprime_caracter(letter_I);
  imprime_caracter(letter_V);
  imprime_caracter(letter_A);
  imprime_caracter(letter_J);
  imprime_caracter(letter_SPC);
  imprime_caracter(letter_SMILIE);
 }
 
 
 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*4  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*5){   

 rampa();
 }
 
 

 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*5  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*6){ 
   
   primera_caracters();



}


 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*6  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*7){   
imprime_caracter(letter_O);
imprime_caracter(letter_Z);
imprime_caracter(letter_A);
imprime_caracter(letter_M);
imprime_caracter(letter_SPC); 
imprime_caracter(letter_A);
imprime_caracter(letter_L);
imprime_caracter(letter_O);
imprime_caracter(letter_M);
}

 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*7  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*8){ 
 espiral();


}

 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*8  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*9){   
inverted_espiral();


}

 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*9  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*10){ 
rampa();


}

 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*10  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*11){   
inverted_rampa();

}
 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*11  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*12){   
doble_espiral();
}
 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*12  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*13){ 
INVERT_rampa();
}

 if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*13  && CONTADOR_DE_VUELTAS< vueltas_por_animacion*14){ 
aleatorio();
}



}
 
 
 
 
 
 
 
 
 
 

 

void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first,
  //on the rising edge of the clock,
  //clock idles low
if (  NUEVA_VUELTA==1 )return;
//internal function setup
  int i=0;
  int pinState;
  //pinMode(myClockPin, OUTPUT);
 // pinMode(myDataPin, OUTPUT);

//clear everything out just in case to
 //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);
if (  NUEVA_VUELTA==1 )return;
  //for each bit in the byte myDataOut�
  //NOTICE THAT WE ARE COUNTING DOWN in our for loop
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights.
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);

    //if the value passed to myDataOut and a bitmask result
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000
    // and proceeds to set pinState to 1.
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    }
    else {   
      pinState= 0;
    }

    //Sets the pin to HIGH or LOW depending on pinState
    if (  NUEVA_VUELTA==1 )return;
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin 
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);
  }

  //stop shifting
  digitalWrite(myClockPin, 0);
}



void INTERRUPT_INICIO_ANIMACION(){  //CUANDO EL OPTOCOUPLER PASE POR LA MUESCA, ES LLAMADA ESTA FUNCION
NUEVA_VUELTA=1;
CONTADOR_DE_VUELTAS++;
last_microsec=microsec;
microsec=micros();
if  (CONTADOR_DE_VUELTAS> vueltas_por_animacion*14){     
CONTADOR_DE_VUELTAS=0;             
       
}



}



void imprime_caracter(const char  caracter[] ){

 
 
   for (int j = sizeof(caracter)+2 ; j > -1 ; j--) {  //parece mentira pero funciona asi..
    //ground latchPin and hold low for as long as you are transmitting
   if (NUEVA_VUELTA==1) break;
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, caracter[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    digitalWrite(latchPin, HIGH);
    delayMicroseconds(tiempovuelta /(espacio_entre_chars*2));
  }
 
 
     digitalWrite(latchPin, LOW);                                       // AQUI VA EL ESPACIO ENTRE CARACTERES
     shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595                         
     shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595                           
     digitalWrite(latchPin, HIGH);                           
     delayMicroseconds(tiempovuelta /espacio_entre_chars);             // AQUI VA EL ESPACIO ENTRE CARACTERES

}

//////////////////////////// here start the animation functions


  void primera_caracters()
{
 imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);   
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
   imprime_caracter(icon_INVERTED_HELICAL);
}

  void circulos()
 {
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
    for (int j = 0; j < sizeof(  circulos_data); j++) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST,   circulos_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST,   circulos_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
  }
 

     
 

void espiral()
{
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
    for (int j = 0; j < sizeof(espiral_data); j++) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, espiral_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, espiral_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
  }
 
 
 
void inverted_espiral()
{
 
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
    for (int j = sizeof(espiral_data); j >0 ; j--) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, espiral_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, espiral_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
  }
 
void inverted_rampa()
{
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
    for (int j = sizeof(rampa_data); j >0 ; j--) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, rampa_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, rampa_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
  }
 
 
 
void rampa()
{
 
   
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
   
    for (int j = 0; j < sizeof(rampa_data); j++) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, rampa_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, rampa_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    }
   
   
void doble_espiral()
{
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
    for (int j = 0; j < sizeof(doble_espiral_data); j++) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, doble_espiral_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, doble_espiral_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
  }
   
   
void INVERT_rampa()
{
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
    for (int j = 0; j < sizeof(INVERT_rampa_data); j++) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, INVERT_rampa_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, INVERT_rampa_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
  }
   
 void aleatorio()
{
    for (int j = 0; j < 12; j++) {
    if (  NUEVA_VUELTA==1 )return;
    for (int j = 0; j < sizeof(aleatorio_data); j++) {
    if (  NUEVA_VUELTA==1 )return; 
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, aleatorio_data[j]);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, aleatorio_data[j]);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1);
  }
if (  NUEVA_VUELTA==1 )return;
}
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //segundo 74hc595
    shiftOut(dataPin, clockPin, MSBFIRST, 0);   //primero 74hc595
    //return the latch pin high to signal chip that it
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
  }