WS2801 LED-Wand Pixel "ausschalten"

Moin Moin,
ich bin Hobbyfotograf und beschäftige mich seit langem mit dem Bereich Lightpainting. Jetzt habe ich bei Kickstarter das Projekt “Pixelstick” entdeckt und wollte eben dieses Projekt nachbauen. Glücklicherweise haben sich schon einige die Mühe (Phil Wright) gemacht und ich wollte davon profitieren. Wie das aber halt immer so ist, wenn man einfach irgendwo Quellcode “klaut” dann versteht man mit unter den Inhalt nicht immer so ganz.

Das Programm Digital Lightwand Code generator wandelt ein JPG in Quellcode für ein Arduino um. Ich habe diesen Code dann an meine Bedürfnisse angepasst und auf das/den Arduino Mega 2560 übertragen.
Das Resultat war das hier >> https://www.dropbox.com/sh/qkzs6tx4b6m5nuw/sP3Go8dcYm<<
Meine Frage ist jetzt, wie bekomme ich die LED`s die gerade keine Farbe erzeugen “ausgeschaltet” bzw. schwarz.

//
//LEDType = WS2801
//HardwareSPI = True
//LCDDisplay = False
//DualStrip =False
//StripControl1 = 1
//StripControl2 = 1
//bitmapWidth = 221
//WandLEDs = 24
//delayOffset = 0
//numOffset = 0
//sdiPin1 = 1
//sdiPin2 = 1
//clkPin1 = 1
//clkPin2 = 1
//StartDelay = 0
//EndDelay = 0
//StrobeOn = 10
//StrobeOff = 0
// Lightwand code generated by Phil Wright
#include <avr/pgmspace.h>
#include <SPI.h>
#define GET_FAR_ADDRESS(var) \
({ \
uint_farptr_t tmp; \
__asm__ __volatile__( \
"ldi    %A0, lo8(%1)"  "\n\t"    \
"ldi    %B0, hi8(%1)"  "\n\t"    \
"ldi    %C0, hh8(%1)"  "\n\t"    \
"clr    %D0"  "\n\t"    \
: \
"=d" (tmp) \
: \
"p"  (&(var)) \
);   \
tmp; \
})
#define STRIP_LENGTH 24 // Total LEDs on this wand
#define STRIP_WIDTH 221 // Width on this strip
int SS = 50;  // Move the SS pin out of the way of the LCD Display (if installed)
 int StripControl1 = 1; //Control Wire for Dual Strip no. 1
long buffer[STRIP_LENGTH];
int tmpbuffer[4];
long lCntr[1];
boolean firstloop=true;
static const uint8_t bitmap_0 [] PROGMEM={0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
.
. Immer so weiter
.
.

0x06,0x01,0x01,0x01,0x01,0x02,0x03,0x03,0x01,0x35,0x07,0x07,0x01,0x68,0x08,0x08,0x01,0x82,0x0A,0x0A,0x01,0x8A,0x0B,0x0B,0x01,0x9B,0x0B,0x0A,0x01,0xA8,0x0B,0x0A,0x01,0xB9,0x0A,0x0A,0x01,0xC7,0x0A,0x0A,0x01,0xD0,0x0A,0x0A,0x01,0xDA,0x0A,0x0A,0x01,0xE4,0x0B,0x0B,0x01,0xEC,0x0B,0x0B,0x01,0xF5,0x0B,0x0A,0x01,0xF9,0x0B,0x0B,0x01,0xFD,0x08,0x08,0x01,0xFE,0x08,0x08,0x01,0xFE,0x08,0x09,
0x0C,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x00,0x01,0x03,0x03,0x03,0x01,0x0D,0x02,0x02,0x01,0x17,0x05,0x05,0x01,0x20,0x05,0x05,0x01,0x2C,0x04,0x04,0x01,0x3A,0x06,0x06,0x01,0x48,0x09,0x09,0x01,0x59,0x09,0x09,0x01,0x6A,0x09,0x09,0x01,0x6E,0x0B,0x0B,
0x18,0x01,0x01,0x01,
0x00};

void writeRGB(uint8_t r,uint8_t g,uint8_t b,int nStrip)
{
  SPI.transfer(r);
  SPI.transfer(g);
  SPI.transfer(b);
  digitalWrite(StripControl1, LOW);
  
  //digitalWrite(StripControl2, LOW);
}
void blank_strip()
{
for(int x = 0 ; x < STRIP_LENGTH; x++)
  buffer[x] = 0;
}
void post_frame (void) {
for(int LED_number = 0 ; LED_number < STRIP_LENGTH ; LED_number++) {
long this_led_color = buffer[LED_number]; //24 bits of color data
writeRGB((this_led_color >> 16) & 0xff,(this_led_color >> 8) & 0xff,(this_led_color) & 0xff,StripControl1);

}
delayMicroseconds(800);
}
void setup() {
pinMode(SS, OUTPUT);
SPI.begin();
blank_strip();
delay(0);
}
void loop() {
for(int x=0;x<STRIP_WIDTH;x++) {
uint_farptr_t farptr;
if(x % 100 ==0) {
switch(x / 100) {
case 0:
farptr=GET_FAR_ADDRESS(bitmap_0);
break;
case 1:
farptr=GET_FAR_ADDRESS(bitmap_1);
break;
case 2:
farptr=GET_FAR_ADDRESS(bitmap_2);
break;
}
}
int bufpos=0;
while(bufpos<STRIP_LENGTH) {
int repeatcolor=pgm_read_byte_far(farptr++);
tmpbuffer[1]=pgm_read_byte_far(farptr++);
tmpbuffer[2]=pgm_read_byte_far(farptr++);
tmpbuffer[3]=pgm_read_byte_far(farptr++);
for(int j=0;j<repeatcolor;j++) {
buffer[bufpos]=(long)tmpbuffer[1] << 16;
buffer[bufpos]|=(long)tmpbuffer[2] << 8;
buffer[bufpos++]|=(long)tmpbuffer[3];
}
}
post_frame();
delay(70);
}delay(100000);
}

Du steuerst sie mit 0,0,0 an. Grüße Uwe

Falls mal irgendwer das selbe Problem hat, poste ich hier meine Lösung

//
//LEDType = WS2801
//HardwareSPI = True
//LCDDisplay = False
//DualStrip =False
//StripControl1 = 1
//bitmapWidth = 221
//WandLEDs = 24
//delayOffset = 0
//numOffset = 0
//sdiPin1 = 1
//sdiPin2 = 1
//clkPin1 = 1
//clkPin2 = 1
//StartDelay = 0
//EndDelay = 0
//StrobeOn = 10
//StrobeOff = 0
// Lightwand code generated by Phil Wright
#include <avr/pgmspace.h>
#include <SPI.h>
#define GET_FAR_ADDRESS(var) \
({ \
uint_farptr_t tmp; \
__asm__ __volatile__( \
"ldi    %A0, lo8(%1)"  "\n\t"    \
"ldi    %B0, hi8(%1)"  "\n\t"    \
"ldi    %C0, hh8(%1)"  "\n\t"    \
"clr    %D0"  "\n\t"    \
: \
"=d" (tmp) \
: \
"p"  (&(var)) \
);   \
tmp; \
})
#define STRIP_LENGTH 24 // Total LEDs on this wand
#define STRIP_WIDTH 221 // Width on this strip
#define FUZZY 3 // min 0 max 7
int SS = 50;  // Move the SS pin out of the way of the LCD Display (if installed)
 int StripControl1 = 1; //Control Wire for Dual Strip no. 1
long buffer[STRIP_LENGTH];
int tmpbuffer[4];
long lCntr[1];
boolean firstloop=true;
static const uint8_t bitmap_0 [] PROGMEM={0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x18,0x01,0x01,0x01,
0x09,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x01,0x17,0x17,0x0A,0x01,0x42,0x45,0x13,0x01,0x65,0x65,0x16,0x01,0x6F,0x6F,0x0F,0x01,0x69,0x69,0x12,0x01,0x4E,0x4E,0x17,0x01,0x23,0x23,0x0D,0x01,0x00,0x00,0x04,0x06,0x01,0x01,0x01,
0x07,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x01,0x47,0x47,0x12,0x01,0xAE,0xAE,0x18,0x01,0xEE,0xEF,0x14,0x02,0xFE,0xFE,0x0E,0x01,0xFE,0xFE,0x0D,0x01,0xFE,0xFE,0x0F,0x01,0xFE,0xFE,0x11,0x01,0xF6,0xF6,0x12,0x01,0xC7,0xC4,0x18,0x01,0x64,0x64,0x16,0x01,0x08,0x08,0x09,0x04,0x01,0x01,0x01,
.
.
.
0x02,0x01,0x01,0x01,0x01,0x1F,0x07,0x07,0x01,0xE5,0x0D,0x0D,0x01,0xF9,0x07,0x07,0x01,0xEF,0x06,0x06,0x02,0xEE,0x06,0x06,0x01,0xF1,0x03,0x03,0x01,0xEA,0x01,0x01,0x01,0xE9,0x05,0x05,0x01,0xE8,0x02,0x02,0x01,0xED,0x01,0x01,0x01,0xF1,0x04,0x05,0x06,0xEE,0x06,0x06,0x01,0xEF,0x06,0x06,0x01,0xFD,0x07,0x06,0x01,0xDE,0x0D,0x0C,0x01,0x2E,0x09,0x09,
0x03,0x01,0x01,0x01,0x01,0x5C,0x0B,0x0B,0x01,0xFC,0x0A,0x0A,0x01,0xF4,0x07,0x07,0x01,0xEF,0x06,0x06,0x03,0xEE,0x06,0x06,0x01,0xF1,0x05,0x05,0x01,0xF1,0x04,0x04,0x09,0xEE,0x06,0x06,0x01,0xEF,0x06,0x06,0x01,0xFD,0x07,0x07,0x01,0xE1,0x0C,0x0C,
0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x68,0x0A,0x0B,0x01,0xF7,0x0D,0x0D,0x01,0xFE,0x06,0x06,0x01,0xF3,0x07,0x07,0x0E,0xEE,0x06,0x06,0x01,0xEF,0x06,0x06,0x01,0xFF,0x07,0x07,
0x05,0x01,0x01,0x01,0x01,0x3D,0x09,0x09,0x01,0xBB,0x0D,0x0D,0x01,0xF5,0x0B,0x0A,0x01,0xFE,0x08,0x08,0x02,0xFE,0x09,0x09,0x01,0xFE,0x09,0x06,0x01,0xFC,0x06,0x06,0x01,0xFA,0x06,0x06,0x01,0xFB,0x06,0x06,0x01,0xF9,0x07,0x07,0x01,0xF4,0x07,0x07,0x01,0xF5,0x06,0x06,0x01,0xF3,0x06,0x06,0x02,0xF0,0x06,0x06,0x01,0xF1,0x06,0x06,0x01,0xEE,0x06,0x06,0x01,0xF1,0x07,0x07,
0x06,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x01,0x33,0x07,0x06,0x01,0x67,0x08,0x08,0x01,0x83,0x0A,0x0A,0x01,0x8B,0x0B,0x0B,0x01,0x99,0x0B,0x0A,0x01,0xA9,0x0A,0x0A,0x01,0xB6,0x0A,0x0A,0x01,0xC4,0x0A,0x0A,0x01,0xD0,0x0A,0x0A,0x01,0xDB,0x0A,0x0A,0x01,0xE5,0x0B,0x0A,0x01,0xEC,0x0B,0x0B,0x01,0xF5,0x0A,0x0A,0x01,0xF9,0x0B,0x0A,0x01,0xFC,0x08,0x08,0x01,0xFE,0x08,0x08,0x01,0xFE,0x08,0x09,
0x0C,0x01,0x01,0x01,0x02,0x01,0x00,0x00,0x01,0x00,0x03,0x03,0x01,0x0B,0x05,0x05,0x01,0x15,0x05,0x05,0x01,0x1E,0x05,0x05,0x01,0x2A,0x04,0x04,0x01,0x39,0x06,0x06,0x01,0x46,0x09,0x09,0x01,0x57,0x09,0x09,0x01,0x68,0x09,0x09,0x01,0x6C,0x0B,0x08,
0x18,0x01,0x01,0x01,
0x00};
void writeRGB(uint8_t r,uint8_t g,uint8_t b,int nStrip)
{
  SPI.transfer(r);
  SPI.transfer(g);
  SPI.transfer(b);
  digitalWrite(StripControl1, LOW);
}
void blank_strip()
{
for(int x = 0 ; x < STRIP_LENGTH; x++)
  buffer[x] = 0;
}
void post_frame (void) {
for(int LED_number = 0 ; LED_number < STRIP_LENGTH ; LED_number++) {
long this_led_color = buffer[LED_number]; //24 bits of color data
writeRGB((this_led_color >> 16) & 0xff,(this_led_color >> 8) & 0xff,(this_led_color) & 0xff,StripControl1);
}
delayMicroseconds(800);
}
void setup() {
pinMode(SS, OUTPUT);
SPI.begin();
blank_strip();
delay(0);
}
void loop() {
 if(firstloop) {
for(int x=0;x<STRIP_WIDTH;x++) {
uint_farptr_t farptr;
if(x % 100 ==0) {
switch(x / 100) {
case 0:
farptr=GET_FAR_ADDRESS(bitmap_0);
break;
case 1:
farptr=GET_FAR_ADDRESS(bitmap_1);
break;
case 2:
farptr=GET_FAR_ADDRESS(bitmap_2);
break;
}
}
int bufpos=0;
while(bufpos<STRIP_LENGTH) {
int repeatcolor=pgm_read_byte_far(farptr++);
tmpbuffer[1]=pgm_read_byte_far(farptr++);
tmpbuffer[2]=pgm_read_byte_far(farptr++);
tmpbuffer[3]=pgm_read_byte_far(farptr++);
for(int j=0;j<repeatcolor;j++) {
buffer[bufpos]=(long)((tmpbuffer[1] >> FUZZY) << FUZZY) << 16;
buffer[bufpos]|=(long)((tmpbuffer[2] >> FUZZY) << FUZZY) << 8;
buffer[bufpos]|=(long)((tmpbuffer[3] >> FUZZY) << FUZZY);
bufpos++;
}
}
post_frame();
delay(80);
}
firstloop = false;
} else {
int bufpos=0;
while(bufpos<STRIP_LENGTH) {
buffer[bufpos]=0;
bufpos++;
post_frame();
}
}
}