Skip to content

Instantly share code, notes, and snippets.

@linuxenko
Created September 7, 2019 16:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save linuxenko/67ee9b604d3967ab004817641226bd91 to your computer and use it in GitHub Desktop.
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
{
uint8_t i;
for (i = 0; i < 8; i++) {
if (bitOrder == LSBFIRST)
digitalWrite(dataPin, !!(val & (1 << i)));
else
digitalWrite(dataPin, !!(val & (1 << (7 - i))));
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment