//AQUI COLOCAMOS TODOS LOS PINES DEL PUERTO D COMO SALIDA
//PINES 7 6 5 4 3 2 1 0
//PUERTO D = A G F E D C B VACIO
//CERO = 1 0 1 1 1 1 1 0
//UNO = 0 0 0 0 0 1 1 0
//DOS = 1 1 0 1 1 0 1 0
//TRES = 1 1 0 0 1 1 1 0
//CUATRO = 0 1 1 0 0 1 1 0
//SIETE = 1 0 0 0 0 1 1 0
// DDRD = B11111111; //AQUI COLOCAMOS TODOS LOS PINES DEL PUERTO D COMO SALIDA
// Initialise Serial Communication to see Register Values
//0x --> así indicamos que es un número en formato hexadecimal
//b o B --> así indicamos que es un numero en formato binario
int dig[] = {0xBE,0x06,0xDA,0xCE,0x66,0x86};
//int dig[] ={190,6,218,206,102,134};
//int dig[] ={B10111110,B00000110,B11011010,B11001110,B01100110 ,B10000110};
int bin = B11111111;
int del = 2000;
void setup()
{
DDRD = B11111111; //TODOS LOS PINES COMO SALIDAS
}
void loop()
{
/* for(int i=0;i<=5;i++)
{
PORTD = dig[i];
delay(1500);
}*/
bin = 0b11111111 ;
PORTD = bin ; //Encendemos todos los leds;
delay(del);
int c = ~bin ; //negamos el contenido de bin
PORTD = c; //negamos el puerto D;
delay(del);
c = (bin & 0b11110000); //realizamos la operación AND
PORTD = c;
delay(del);
c = (bin & 0b00001111);
PORTD = c;
delay(del);
bin = 0b00000001 ;
PORTD = bin;
delay(del);
c = bin << 2;
PORTD = c;
delay(del);
bin = 0b00000001 ;
for(int i=0; i<=7 ;i++){
c = bin << i ;
PORTD = c;
delay(50);
}
delay(del);
bin = 0b10000000 ;
for(int i=0; i<=7;i++){
c = bin >> i ;
PORTD = c;
delay(50);
}
delay(del);
}
// LA TAREA DE BRANDON ES HACER QUE LOS LEDS LE DEN LA VUELTA A TODO EL ARDUINO USANDO TODOS LOS PUERTOS
// 5 VECES EN SENTIDO HORARIO
// 3 VECES EN SENTIDO ANTIHORARIO