Page 27 - Proyecto - Ana Guerrero
P. 27

EJERCICIO # 18







               Conectar  9  diodos  leds  formando  un  cuadrado


               perfecto  donde  los  leds  encenderán  la  forma  de


               una letra: X, Z, Y, A con unas resistencias de 220

               ohmio.






















                    int ld0=0;              digitalWrite(ld7, HIGH);                        //Y
                    int ld1=1;               digitalWrite(ld8, HIGH);  digitalWrite(ld0, HIGH);
                    int ld2=2;                      delay(2000);               digitalWrite(ld1, LOW);
                    int ld3=3;                                                digitalWrite(ld2, HIGH);
                    int ld4=4;                           //X//                 digitalWrite(ld3, LOW);
                    int ld5=5;                             {                  digitalWrite(ld4, HIGH);
                    int ld6=6;               digitalWrite(ld0, HIGH);  digitalWrite(ld5, LOW);
                    int ld7=7;               digitalWrite(ld1, LOW);           digitalWrite(ld6, LOW);
                    int ld8=8;               digitalWrite(ld2, HIGH);  digitalWrite(ld7, HIGH);
                   void setup()              digitalWrite(ld3, LOW);           digitalWrite(ld8, LOW);
                          {                  digitalWrite(ld4, HIGH);                 delay(3000);
              pinMode(ld0, OUTPUT);          digitalWrite(ld5, LOW);
              pinMode(ld1, OUTPUT);  digitalWrite(ld6, HIGH);                               //A
              pinMode(ld2, OUTPUT);          digitalWrite(ld7, LOW);           digitalWrite(ld0, LOW);
              pinMode(ld3, OUTPUT);  digitalWrite(ld8, HIGH);  digitalWrite(ld1, HIGH);
              pinMode(ld4, OUTPUT);                 delay(2000);               digitalWrite(ld2, LOW);
              pinMode(ld5, OUTPUT);                                            digitalWrite(ld3, LOW);
              pinMode(ld6, OUTPUT);                       //Z                 digitalWrite(ld4, HIGH);
              pinMode(ld7, OUTPUT);                                            digitalWrite(ld5, LOW);
              pinMode(ld8, OUTPUT);  digitalWrite(ld0, HIGH);  digitalWrite(ld6, HIGH);
                                             digitalWrite(ld1, HIGH);  digitalWrite(ld7, HIGH);
                          }                  digitalWrite(ld2, HIGH);  digitalWrite(ld8, HIGH);
                    void loop()              digitalWrite(ld3, LOW);                  delay(5000);
                                             digitalWrite(ld4, HIGH);
            digitalWrite(ld6, HIGH);  digitalWrite(ld5, LOW);                                 }
   22   23   24   25   26   27   28   29   30   31   32