Advertisement
bitwise_gamgee

Untitled

Jul 7th, 2023
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. // Pins connected to 74HC595
  2. const int latchPin = 8;
  3. const int clockPin = 12;
  4. const int dataPin = 11;
  5.  
  6. void setup() {
  7.   pinMode(latchPin, OUTPUT);
  8.   pinMode(clockPin, OUTPUT);
  9.   pinMode(dataPin, OUTPUT);
  10. }
  11.  
  12. void loop() {
  13.   for (int i = 0; i < 256; i++) { // loop through all 256 possible states
  14.     digitalWrite(latchPin, LOW);
  15.     shiftOut(dataPin, clockPin, MSBFIRST, i);
  16.     digitalWrite(latchPin, HIGH);
  17.     delay(100);
  18.   }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement