-
-
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.
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
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