Advertisement
sirik13

sequential printing shift register

Apr 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. const int SER =8;
  2. const int LATCH =9;
  3. const int CLK =10;
  4. int seq [] = {1, 2, 4, 8, 16, 32, 64, 128, 64, 32, 16, 8, 4, 2, 1};
  5.  
  6. void setup() {
  7. pinMode (SER, OUTPUT);
  8. pinMode (LATCH, OUTPUT);
  9. pinMode (CLK, OUTPUT);
  10.  
  11. }
  12.  
  13. void loop() {
  14. for (int i= 0; i<15; i++)
  15. {
  16. digitalWrite (LATCH, LOW);
  17. shiftOut (SER, CLK, MSBFIRST, seq [i]);
  18. digitalWrite (LATCH, HIGH);
  19. delay (100);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement