Last active
February 1, 2016 21:51
-
-
Save Tmw/f93966858ebcd114fbef to your computer and use it in GitHub Desktop.
expanding our turnOnLed function
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
// 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