Skip to content

Instantly share code, notes, and snippets.

@Tmw
Last active February 1, 2016 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tmw/f93966858ebcd114fbef to your computer and use it in GitHub Desktop.
Save Tmw/f93966858ebcd114fbef to your computer and use it in GitHub Desktop.
expanding our turnOnLed function
// turn on correct LED using 595's
void turnOnLed(int ledNr, int layer) {
digitalWrite(latchPin, LOW);
SPI.transfer(1<<layer);
if (ledNr >= 8) {
SPI.transfer(1<<ledNr-8);
SPI.transfer(0);
}
else {
SPI.transfer(0);
SPI.transfer(1<<ledNr);
}
digitalWrite(latchPin, HIGH);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment