Created
May 14, 2017 17:42
-
-
Save giljr/d8b72079bba010627aed7a767d15c367 to your computer and use it in GitHub Desktop.
How Shift Register works? Page https://goo.gl/GcZxCR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int clockPin = 9; | |
const int dataPin = 8; | |
void setup(){ | |
pinMode(clockPin, OUTPUT); | |
pinMode(dataPin, OUTPUT); | |
} | |
void loop(){ | |
for(int i = 0; i<8; i++) | |
{ | |
shiftOut(dataPin, clockPin, MSBFIRST, B00000001 << i); | |
delay(125);//125*8 = 1 second | |
} | |
for (int i = 0; i<8; i++){ | |
shiftOut(dataPin, clockPin, MSBFIRST, B10000000 >> i); | |
delay(125);//125*8 = 1 second | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment