Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Last active April 26, 2020 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/c419c96dfb558c0fd08fb105a5a2b32e to your computer and use it in GitHub Desktop.
Save JeffersGlass/c419c96dfb558c0fd08fb105a5a2b32e to your computer and use it in GitHub Desktop.
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