際際滷

際際滷Share a Scribd company logo
int numero_bin = 0;
void setup() {
//establecer entradas: BOTONES:
pinMode(1, INPUT); //E5
pinMode(2, INPUT); //E4
pinMode(3, INPUT); //E3
pinMode(4, INPUT); //E2
pinMode(5, INPUT); //E1
//establecer salidas: LEDS:
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void apagar_leds(){
for (int x=6;x<14;x++){
digitalWrite(x, LOW);
}
}
void encender_leds(){
for (int x=6;x<14;x++){
digitalWrite(x, HIGH);
}
}
void imprimir_caracter(int numero){
apagar_leds();
switch(numero){
case 0:
digitalWrite(10, HIGH);
break;
case 1:
digitalWrite(12, HIGH);
digitalWrite(10, HIGH);
digitalWrite(7, HIGH);
digitalWrite(11, HIGH);
digitalWrite(6, HIGH);
break;
case 2:
digitalWrite(11, HIGH);
digitalWrite(8, HIGH);
break;
case 3:
digitalWrite(11, HIGH);
digitalWrite(6, HIGH);
break;
case 4:
digitalWrite(12, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
break;
case 5:
digitalWrite(6, HIGH);
digitalWrite(13, HIGH);
break;
case 6:
digitalWrite(13, HIGH);
break;
case 7:
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(7, HIGH);
digitalWrite(6, HIGH);
break;
case 8:
break;
case 9:
digitalWrite(7, HIGH);
digitalWrite(6, HIGH);
break;
case 10://a
digitalWrite(7, HIGH);
break;
case 11://b
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
break;
case 12://c
digitalWrite(8, HIGH);
digitalWrite(10, HIGH);
digitalWrite(13, HIGH);
break;
case 13://d
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
break;
case 14://e
digitalWrite(8, HIGH);
digitalWrite(13, HIGH);
break;
case 15://f
digitalWrite(7, HIGH);
digitalWrite(13, HIGH);
digitalWrite(8, HIGH);
break;
}
}
int leer_valor(int x){
int valor = 0;
switch(x){
case 8:valor = 1;break;
case 9:valor = 2;break;
case 10:valor = 4;break;
case 11:valor = 8;break;
}
return valor;
}
void seleccionar_opcion(int num){
switch(num){
case 1:
for(int x=0;x<16;x++){
imprimir_caracter(x);
delay(1000);
}
break;
case 2:
for(int x=15;x>=0;x--){
imprimir_caracter(x);
delay(100);
}
break;
case 3:
imprimir_caracter(random(0, 15));
break;
case 4:
for(int x=0;x<16;x++){
imprimir_caracter(x);
delay(1000);
}
break;
case 5:
for(int x=15;x>=0;x--){
imprimir_caracter(x);
delay(100);
}
break;
}
}
void loop(){
/*
for (int x=2;x<6;x++){
if (digitalRead(x)==HIGH){
numero_bin += leer_valor(x);
delay(500);
}
}
imprimir_caracter(numero_bin);
numero_bin = 0;
*/
digitalWrite(13, LOW);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
}

More Related Content

Primer intentop9

  • 1. int numero_bin = 0; void setup() { //establecer entradas: BOTONES: pinMode(1, INPUT); //E5 pinMode(2, INPUT); //E4 pinMode(3, INPUT); //E3 pinMode(4, INPUT); //E2 pinMode(5, INPUT); //E1 //establecer salidas: LEDS: pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); Serial.begin(9600); } void apagar_leds(){ for (int x=6;x<14;x++){ digitalWrite(x, LOW); } } void encender_leds(){ for (int x=6;x<14;x++){ digitalWrite(x, HIGH); } } void imprimir_caracter(int numero){ apagar_leds(); switch(numero){ case 0: digitalWrite(10, HIGH); break; case 1: digitalWrite(12, HIGH); digitalWrite(10, HIGH); digitalWrite(7, HIGH); digitalWrite(11, HIGH); digitalWrite(6, HIGH); break; case 2: digitalWrite(11, HIGH); digitalWrite(8, HIGH); break; case 3: digitalWrite(11, HIGH); digitalWrite(6, HIGH); break; case 4: digitalWrite(12, HIGH); digitalWrite(6, HIGH); digitalWrite(7, HIGH); break; case 5: digitalWrite(6, HIGH); digitalWrite(13, HIGH);
  • 2. break; case 6: digitalWrite(13, HIGH); break; case 7: digitalWrite(11, HIGH); digitalWrite(10, HIGH); digitalWrite(7, HIGH); digitalWrite(6, HIGH); break; case 8: break; case 9: digitalWrite(7, HIGH); digitalWrite(6, HIGH); break; case 10://a digitalWrite(7, HIGH); break; case 11://b digitalWrite(13, HIGH); digitalWrite(12, HIGH); break; case 12://c digitalWrite(8, HIGH); digitalWrite(10, HIGH); digitalWrite(13, HIGH); break; case 13://d digitalWrite(12, HIGH); digitalWrite(11, HIGH); break; case 14://e digitalWrite(8, HIGH); digitalWrite(13, HIGH); break; case 15://f digitalWrite(7, HIGH); digitalWrite(13, HIGH); digitalWrite(8, HIGH); break; } } int leer_valor(int x){ int valor = 0; switch(x){ case 8:valor = 1;break; case 9:valor = 2;break; case 10:valor = 4;break; case 11:valor = 8;break; } return valor; } void seleccionar_opcion(int num){ switch(num){ case 1: for(int x=0;x<16;x++){ imprimir_caracter(x); delay(1000); } break; case 2:
  • 3. for(int x=15;x>=0;x--){ imprimir_caracter(x); delay(100); } break; case 3: imprimir_caracter(random(0, 15)); break; case 4: for(int x=0;x<16;x++){ imprimir_caracter(x); delay(1000); } break; case 5: for(int x=15;x>=0;x--){ imprimir_caracter(x); delay(100); } break; } } void loop(){ /* for (int x=2;x<6;x++){ if (digitalRead(x)==HIGH){ numero_bin += leer_valor(x); delay(500); } } imprimir_caracter(numero_bin); numero_bin = 0; */ digitalWrite(13, LOW); delay(1000); digitalWrite(12, LOW); delay(1000); }