-
-
Save JeffersGlass/c419c96dfb558c0fd08fb105a5a2b32e to your computer and use it in GitHub Desktop.
This file contains 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
int CLOCK_PIN = 10; | |
int DATA_PIN = 11; | |
int LATCH_PIN = 12; | |
void setup() { | |
pinMode(CLOCK_PIN, OUTPUT); | |
pinMode(DATA_PIN, OUTPUT); | |
pinMode(LATCH_PIN, OUTPUT); | |
} | |
void loop() { | |
sendByteOut(B11110000); | |
delay(1000); | |
sendByteOut(B00001111); | |
delay(1000); | |
} | |
void sendByteOut(byte value){ | |
//shiftOut(dataPin, clockPin, bitOrder, value) | |
digitalWrite(LATCH_PIN, LOW); //set the latch to low so we can raise it later | |
digitalWrite(CLOCK_PIN, LOW); //make sure clock pin is low before we start | |
shiftOut(DATA_PIN, CLOCK_PIN, LSBFIRST, value); //Shift out the data | |
digitalWrite(LATCH_PIN, HIGH); //Latch the data in | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment