But I notice that my colors Green and Blue are backwards. Is this just wired wrong in my strip? I'd assume if it was the code it would be posted about and probably fixed.
colorChase(strip.Color(0,127,0), 20); // green * This is in fact coming out BLUE
and
colorChase(strip.Color(0,0,127), 20); // blue *This comes out GREEN
Am I missing an obvious error on my part?
Can anyone guide me to an explanation on how the Wheel helper function works? I'd really like to read up and learn how it works than just changing inputs and hoping for the best.
It suggests your controller is a little weird. By the looks of things the library uses a GRB colour format when sending the data, and presumably your controller requires BRG format.
A work around for this would be to open the LPD8806.cpp file and change this:
void LPD8806::show(void) {
uint16_t i, index, n3 = numLEDs * 3 + 1; // 3 bytes per LED + 1 for latch
// write 24 bits per pixel
if (hardwareSPI) {
for (i=0; i<n3; i++ ) {
while(!(SPSR & (1<<SPIF))); // Wait for prior byte out
SPDR = pixels[i]; // Issue new byte
}
} else {
for (i=0; i<n3; i++ ) {
for (uint8_t bit=0x80; bit; bit >>= 1) {
if(pixels[i] & bit) *dataport |= datapinmask;
else *dataport &= ~datapinmask;
*clkport |= clkpinmask;
*clkport &= ~clkpinmask;
}
}
}
}
To this:
void LPD8806::show(void) {
uint16_t i, index;
// write 24 bits per pixel
if (hardwareSPI) {
for (i=0; i<numLEDs; i++) {
index = i*3;
for(char j = 2; j >= 0; j--){ //revese the colour order
while(!(SPSR & (1<<SPIF))); // Wait for prior byte out
SPDR = pixels[index + j]; // Issue new byte
}
}
//Finally the latch byte
while(!(SPSR & (1<<SPIF))); // Wait for prior byte out
SPDR = pixels[numLEDs * 3]; // Issue new byte
} else {
for (i=0; i<numLEDs; i++) {
index = i*3;
for(char j = 2; j >= 0; j--){ //revese the colour order
for (uint8_t bit=0x80; bit; bit >>= 1) {
if(pixels[index + j] & bit){
*dataport |= datapinmask;
} else {
*dataport &= ~datapinmask;
}
*clkport |= clkpinmask;
*clkport &= ~clkpinmask;
}
}
}
//Finally the latch byte
for (uint8_t bit=0x80; bit; bit >>= 1) {
if(pixels[numLEDs * 3] & bit){
*dataport |= datapinmask;
} else {
*dataport &= ~datapinmask;
}
*clkport |= clkpinmask;
*clkport &= ~clkpinmask;
}
}
}