Advertisement
ananias_hayes12

Shift Register Array LED

Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. /* Controlling lights with Void Loop and Shift Register
  2. * AANIAS HAYES
  3. */
  4.  
  5. const int SER = 8;
  6. const int LATCH = 9;
  7. const int CLK = 10;
  8. int byte1= 0;
  9. int byte2 = 0;
  10. int lights [15] = { 1, 2, 4, 8, 16, 32, 64, 128, 64, 32, 16, 8, 4, 2, 1};
  11.  
  12. void setup()
  13. {
  14. pinMode (SER, OUTPUT);
  15. pinMode (LATCH, OUTPUT);
  16. pinMode (CLK, OUTPUT);
  17. }
  18.  
  19. void loop()
  20. {
  21. for (byte2 = 0; byte2 < 256; byte2++)
  22. for (byte1 = 0; byte1 < 256; byte1++)
  23. for (int i = 0; i < 15; i++)
  24. {
  25. digitalWrite (LATCH, LOW);
  26. shiftOut (SER, CLK, MSBFIRST, lights [i]);
  27.  
  28. digitalWrite (LATCH, HIGH);
  29. delay (100);
  30. }
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement