Arduino
Ir a la navegación
Ir a la búsqueda
Projectes
Comptador
Per a fer aquest comptador utlitzem un Display BCD i un xip cd4511be
Si tenim en compte que el xip decodificador té aquestes entrades:
i el display aquestes:
Les connexions quedaran:
| Arduino | cd4511be |
|---|---|
| 2 | A |
| 3 | B |
| 4 | C |
| 5 | D |
| 5v | Vdd, LT, BL |
| GND | VSS, LE |
void setup()
{
for (int i=2;i<6;i++){
pinMode(i,OUTPUT);
}
}
void loop()
{
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,0);
digitalWrite(3,1);
digitalWrite(4,0);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,0);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,1);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,1);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,0);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,1);
digitalWrite(5,0);
delay(1000);
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(5,1);
delay(1000);
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
digitalWrite(5,1);
delay(1000);
}
Enllaços
http://learn.adafruit.com/all-about-leds?view=all http://www.sentex.ca/~mec1995/tutorial/7seg/7seg.html

