Advertisement
RuiViana

595 sequencial

Nov 5th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1.  
  2. /*¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
  3. - Pino 2 do Arduino ligado ao pino 12 do CI.
  4. - Pino 3 do Arduino ligado ao pino 14 do CI.
  5. - Pino 4 do Arduino ligado ao pino 11 do CI.
  6. - Pinos 10 e 16 do CI ligados ao Vcc.
  7. - Pinos 8 e 13 do CI ligados ao GND.
  8. ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨*/
  9. #include <ShiftOutMega.h> //Inclui a bilioteca ShiftOutMega.h
  10.  
  11. //Variáveis do CI 74HC595
  12. int latchPin = 2;
  13. int dataPin = 3;
  14. int clockPin = 4;
  15. int qtdRegistradores = 1; //Quantidade de registradores(74HC595) utilizado no pro jeto.
  16. ShiftOutMega mega1(latchPin, dataPin, clockPin, qtdRegistradores); //Inicia a biblioteca passando os parametros de uso.
  17.  
  18. // ------------------------ Função Acende todos e apaga um a um
  19. void painel ()
  20. {
  21. mega1.shiftWrite(1, HIGH); //Ligando painel verde 1
  22. mega1.shiftWrite(2, HIGH);
  23. mega1.shiftWrite(3, HIGH);
  24. mega1.shiftWrite(4, HIGH);
  25. mega1.shiftWrite(5, HIGH);
  26. mega1.shiftWrite(6, HIGH);
  27. mega1.shiftWrite(7, HIGH);
  28. mega1.shiftWrite(8, HIGH);
  29. mega1.shiftWrite(9, HIGH);
  30. mega1.shiftWrite(10, HIGH);
  31. delay(1000);
  32.  
  33. mega1.shiftWrite(1, LOW); //Desligando painel verde 1
  34. delay(1000);
  35. mega1.shiftWrite(2, LOW);
  36. delay(1000);
  37. mega1.shiftWrite(3, LOW);
  38. delay(1000);
  39. mega1.shiftWrite(4, LOW);
  40. delay(1000);
  41. mega1.shiftWrite(5, LOW);
  42. delay(1000);
  43. mega1.shiftWrite(6, LOW);
  44. delay(1000);
  45. mega1.shiftWrite(7, LOW);
  46. delay(1000);
  47. mega1.shiftWrite(8, LOW);
  48. delay(1000);
  49. mega1.shiftWrite(9, LOW);
  50. delay(1000);
  51. mega1.shiftWrite(10, LOW);
  52. delay(1000);
  53. }
  54. //------------------------------------------------
  55. void setup()
  56. {
  57. }
  58. //------------------------------------------------
  59. void loop()
  60. {
  61. painel ();
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement