Skip to content

Instantly share code, notes, and snippets.

@matthewellis
Forked from tmpvar/TLC5971 breakout.jpg
Last active December 19, 2015 17:28
Show Gist options
  • Save matthewellis/5991426 to your computer and use it in GitHub Desktop.
Save matthewellis/5991426 to your computer and use it in GitHub Desktop.
Swapped blue and red write commands as they where in the wrong order.
void setup() {
pinMode(2, OUTPUT); // power
pinMode(3, OUTPUT); // SDI
pinMode(4, OUTPUT); // SCK
}
char r[8] = { 0xFF, 0x00, 0x00 };
char g[8] = { 0x00, 0xff, 0x00 };
char b[8] = { 0x00, 0x00, 0xff };
char data[4] = { 0x94, 0x50, 0x0F, 0xFF };
int seq = 0;
void write(byte out) {
shiftOut(3, 4, MSBFIRST, out);
}
void loop() {
digitalWrite(2, HIGH);
int i = 0;
while (i < 8) {
if (i > 3) {
write(b[seq]);
write(b[seq]);
write(g[seq]);
write(g[seq]);
write(r[seq]);
write(r[seq]);
} else {
write(data[i]);
}
i++;
}
delay(1000);
seq++;
if (seq == 3) {
seq = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment