Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Last active April 26, 2020 18:31
Show Gist options
  • Save JeffersGlass/20596cf3ab00792508f9e556d1aad62b to your computer and use it in GitHub Desktop.
Save JeffersGlass/20596cf3ab00792508f9e556d1aad62b 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() {
//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, B11110000); //Shift out the data
digitalWrite(LATCH_PIN, HIGH); //Latch the data in
delay(1000);
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, B00001111); //Shift out the data
digitalWrite(LATCH_PIN, HIGH); //Latch the data in
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment