Last active
December 10, 2015 12:48
-
-
Save cchase88/4436267 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
// lightUp takes a byte | |
void lightUp(byte seq){ | |
// Loop through each of the 8 bits | |
for(int i=0;i<8;i++){ | |
// If the current bit is a 1... | |
if(bitRead(seq, i)){ | |
// turn on that LED by sending HIGH. | |
// The 5 below is the starting pin used on the | |
// Arduino. | |
digitalWrite(i+5, HIGH); | |
} | |
// If the current bit is set to 0... | |
else{ | |
// Send the LED a LOW to turn it off. | |
digitalWrite(i+5, LOW); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment