PROYECTO 7.2: DISPLAY CUENTA ATRÁS
Consiste
en reproducir la cuenta atrás que propone el libro en la página
162.
#define Pin_a 3
#define Pin_b 4
#define Pin_c 7
#define Pin_d 6
#define Pin_e 5
#define Pin_f 2
#define Pin_g 1
void setup ()
{
pinMode(Pin_a,OUTPUT);
pinMode(Pin_b,OUTPUT);
pinMode(Pin_c,OUTPUT);
pinMode(Pin_d,OUTPUT);
pinMode(Pin_e,OUTPUT);
pinMode(Pin_f,OUTPUT);
pinMode(Pin_g,OUTPUT);
}
void loop()
{
//Cuenta atras desde nueve
nueve();
delay(500);
ocho();
delay(500);
siete();
delay(500);
seis();
delay(500);
cinco();
delay(500);
cuatro();
delay(500);
tres();
delay(500);
dos();
delay(500);
uno();
delay(500);
cero();
delay(500);
}
void nueve ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void ocho ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void siete ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, LOW);
}
void seis ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, LOW);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void cinco ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, LOW);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void cuatro ()
{
digitalWrite (Pin_a, LOW);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void tres ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, HIGH);
}
void dos ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, LOW);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, HIGH);
}
void uno ()
{
digitalWrite (Pin_a, LOW);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, LOW);
}
void cero ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, LOW);
}
#define Pin_a 3
#define Pin_b 4
#define Pin_c 7
#define Pin_d 6
#define Pin_e 5
#define Pin_f 2
#define Pin_g 1
void setup ()
{
pinMode(Pin_a,OUTPUT);
pinMode(Pin_b,OUTPUT);
pinMode(Pin_c,OUTPUT);
pinMode(Pin_d,OUTPUT);
pinMode(Pin_e,OUTPUT);
pinMode(Pin_f,OUTPUT);
pinMode(Pin_g,OUTPUT);
}
void loop()
{
//Cuenta atras desde nueve
nueve();
delay(500);
ocho();
delay(500);
siete();
delay(500);
seis();
delay(500);
cinco();
delay(500);
cuatro();
delay(500);
tres();
delay(500);
dos();
delay(500);
uno();
delay(500);
cero();
delay(500);
}
void nueve ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void ocho ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void siete ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, LOW);
}
void seis ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, LOW);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void cinco ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, LOW);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void cuatro ()
{
digitalWrite (Pin_a, LOW);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, HIGH);
}
void tres ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, HIGH);
}
void dos ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, LOW);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, HIGH);
}
void uno ()
{
digitalWrite (Pin_a, LOW);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, LOW);
digitalWrite (Pin_e, LOW);
digitalWrite (Pin_f, LOW);
digitalWrite (Pin_g, LOW);
}
void cero ()
{
digitalWrite (Pin_a, HIGH);
digitalWrite (Pin_b, HIGH);
digitalWrite (Pin_c, HIGH);
digitalWrite (Pin_d, HIGH);
digitalWrite (Pin_e, HIGH);
digitalWrite (Pin_f, HIGH);
digitalWrite (Pin_g, LOW);
}
Comentarios
Publicar un comentario