Skip to content

Instantly share code, notes, and snippets.

@cchase88
Last active December 10, 2015 12:48
Show Gist options
  • Save cchase88/4436267 to your computer and use it in GitHub Desktop.
Save cchase88/4436267 to your computer and use it in GitHub Desktop.
// 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