#include #define SER_Pin 5 // dataPin #define RCLK_Pin 7 // lacthPin #define SRCLK_Pin 6 // clockPin #define NUM_REGISTERS 3 //Aquí se definen cuántos registros de desplazamiento hay en la cadena... //Inicializar el registro de desplazamiento usando la libreria "Shifter" Shifter shifter(SER_Pin, RCLK_Pin, SRCLK_Pin, NUM_REGISTERS); // the number of the pushbutton pin // IN1 = pin 2; IN2 = pin 3; IN3 = pin 8; IN2 = pin 9; const int buttonPin = 3; // variables will change: int buttonState = 0; // variable for reading the pushbutton status void setup(){ // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop(){ //Ejemplos de sentencias que admite la libreria "Shifter": //shifter.clear(); //Desactiva todas las salidas de todos los registros de desplazamiento de la cadena //shifter.write(); //send changes to the chain and display them //delay(100); //shifter.setAll(HIGH); //Activa todas las salidas de todos los registros de desplazamiento de la cadena //shifter.write(); //send changes to the chain and display them //delay(500); // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == LOW) { shifter.setPin(0, HIGH); //set pin 0 in the chain (first pin, firt register) HIGH shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(7, HIGH); //set pin 14 in the chain (six pin, second register) HIGH shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(14, HIGH); shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(15, HIGH); shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(20, HIGH); shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); } else { shifter.setPin(0, LOW); //set pin 0 in the chain (first pin, firt register) HIGH shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(7, LOW); shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(14, LOW); //set pin 14 in the chain (six pin, second register) HIGH shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(15, LOW); shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); shifter.setPin(20, LOW); shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make delay(300); } //shifter.setPin(0, LOW); //set pin 0 in the chain (first pin, firt register) LOW //shifter.setPin(1, LOW); //shifter.setPin(2, LOW); //shifter.setPin(14, HIGH); //set pin 14 in the chain (six pin, second register) LOW //shifter.setPin(15, HIGH); //shifter.write(); //send changes to the chain and display them //notice how you only call write after you make all the changes you want to make //delay(500); }