Page 28 - Proyecto - Ana Guerrero
P. 28
EJERCICIO # 19
Conectar 12 diodos leds formando 3 filas y 4
columnas donde los leds encienden en forma de
números: 5,4,3,2,1 con resistencias de 220 ohmios.
int ld0 = 0; digitalWrite(ld3, HIGH); digitalWrite(ld8, LOW);
int ld1 = 1; digitalWrite(ld4, HIGH); delay(2000);
int ld2 = 2; digitalWrite(ld5, HIGH);
digitalWrite(ld6, LOW);
int ld3 = 3; //2//
digitalWrite(ld7, LOW);
int ld4 = 4; digitalWrite(ld0, HIGH);
digitalWrite(ld8, LOW);
int ld5 = 5; digitalWrite(ld1, HIGH);
int ld6 = 6; delay(2000); digitalWrite(ld2, HIGH);
int ld7 = 7; //4// digitalWrite(ld3, HIGH);
int ld8 = 8; digitalWrite(ld0, HIGH); digitalWrite(ld4, HIGH);
void setup() digitalWrite(ld1, HIGH); digitalWrite(ld5, HIGH);
{ digitalWrite(ld2, LOW); digitalWrite(ld6, LOW);
pinMode(ld0, OUTPUT); digitalWrite(ld3, HIGH); digitalWrite(ld7, LOW);
pinMode(ld1, OUTPUT); digitalWrite(ld4, HIGH); digitalWrite(ld8, LOW);
digitalWrite(ld5, HIGH);
pinMode(ld2, OUTPUT); delay(2000);
digitalWrite(ld6, LOW);
pinMode(ld3, OUTPUT);
digitalWrite(ld7, LOW);
pinMode(ld4, OUTPUT); //1//
digitalWrite(ld8, LOW);
pinMode(ld5, OUTPUT); delay(2000); digitalWrite(ld0, LOW);
pinMode(ld6, OUTPUT); digitalWrite(ld1, HIGH);
pinMode(ld7, OUTPUT); //3// digitalWrite(ld2, LOW);
pinMode(ld8, OUTPUT); digitalWrite(ld0, HIGH); digitalWrite(ld3, HIGH);
} digitalWrite(ld1, HIGH); digitalWrite(ld4, HIGH);
void loop() digitalWrite(ld2, HIGH); digitalWrite(ld5, HIGH);
{ digitalWrite(ld3, HIGH); digitalWrite(ld6, LOW);
digitalWrite(ld4, HIGH);
//5// digitalWrite(ld7, LOW);
digitalWrite(ld5, HIGH);
digitalWrite(ld0, HIGH); digitalWrite(ld8, LOW);
digitalWrite(ld6, LOW);
digitalWrite(ld1, HIGH); delay(2000);
digitalWrite(ld7, LOW);
digitalWrite(ld2, HIGH); }