ROSALES_RUIZ

PRUEBA DE USO PUERTO D

Oct 21st, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. int contador=0; //declaracion de variable interna
  2.  
  3. void setup()
  4. {
  5.   DDRD=B11111111; //Se utiliza D porque es del 0 al 7 y B porque es Binario
  6.   //se  observa que los pines 0 y 1 no se utilizan
  7. }
  8. void loop ()
  9. {
  10.   for (contador=0; contador<3; contador++) //se establece contador menor que 3 porque solo son 3 casos
  11.   {
  12.     switch(contador)
  13.     {
  14.       case 0:
  15.       PORTD=B11111111; //Aqui se encienden todos los leds
  16.       delay (2000);
  17.      
  18.       case 1:
  19.       PORTD=B10101010; //Se apagan 4 leds
  20.       delay (2000);
  21.      
  22.       case 2:
  23.       PORTD=B00000000; //Se apagan todos los leds
  24.       delay (2000);
  25.     }
  26.     }
  27.   }
Advertisement
Add Comment
Please, Sign In to add comment