Skip to content

Instantly share code, notes, and snippets.

@mrizvic
Last active September 3, 2015 12:49
Show Gist options
  • Save mrizvic/c1462655f8b8adf52764 to your computer and use it in GitHub Desktop.
Save mrizvic/c1462655f8b8adf52764 to your computer and use it in GitHub Desktop.
byte muxCount = 0;
byte lookup[17]={0,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8};
void displayRing(byte number) {
byte groupMin = (4 * muxCount) + 1;
byte groupMax = (4 * muxCount) + 4;
byte A = 0;
byte B = 0;
if (number > 0) {
if ( (number >= groupMin) && (number <= groupMax) ) {
A = lookup[number];
B = 1 << muxCount;
}
}
byte PORT;
PORT = (B << 4) + A;
muxCount++;
muxCount = muxCount % 4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment