Created
September 7, 2019 16:07
-
-
Save linuxenko/67ee9b604d3967ab004817641226bd91 to your computer and use it in GitHub Desktop.
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
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