ok So I have resolved my issue with the WS2801's not lighting up but now I have a problem with the battery. I want my project to be portable so I can programme the arduino mega 2560 on the laptop then take it to the position and take my lightpainting shot with the board and LED powered by battery. but it seems that the light sequence works perfectly when I have the board plugged into the laptop via usb. But as soon as I disconnect the USB and connect the battery and switch the pack on the lights just go all red with this code below
//
//LEDType = WS2801
//HardwareSPI = True
//LCDDisplay = False
//DualStrip =False
//StripControl1 = 1
//StripControl2 = 1
//bitmapWidth = 16
//WandLEDs = 12
//delayOffset = 0
//numOffset = 0
//sdiPin1 = 51
//sdiPin2 = 51
//clkPin1 = 52
//clkPin2 = 1
//StartDelay = 0
//EndDelay = 0
//StrobeOn = 419
//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 12 // Total LEDs on this wand
#define STRIP_WIDTH 16 // Width on this strip
#if defined(ARDUINO) && ARDUINO >= 100
#else
const uint8_t SS = 50; // Move the SS pin out of the way of the LCD Display (if installed)
#endif
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={0x02,0xFE,0x1A,0x01,0x01,0xFF,0x20,0x00,0x01,0xFE,0x20,0x02,0x01,0xFF,0x1D,0x03,0x01,0xFD,0x15,0x03,0x01,0xF7,0x0F,0x03,0x01,0xE9,0x09,0x03,0x01,0xD9,0x05,0x03,0x01,0xC9,0x03,0x03,0x01,0xB1,0x01,0x03,0x01,0x95,0x01,0x03,
0x02,0xFE,0x28,0x00,0x01,0xFE,0x33,0x03,0x01,0xFF,0x2F,0x03,0x01,0xFF,0x26,0x03,0x01,0xFF,0x1C,0x03,0x01,0xFF,0x14,0x02,0x01,0xFF,0x0D,0x02,0x01,0xF7,0x06,0x02,0x01,0xE5,0x02,0x03,0x01,0xCA,0x00,0x03,0x01,0xAF,0x00,0x03,
0x02,0xFC,0x38,0x00,0x01,0xFE,0x40,0x03,0x01,0xFA,0x3D,0x02,0x01,0xFA,0x33,0x03,0x01,0xFA,0x29,0x02,0x01,0xFD,0x1C,0x03,0x01,0xFA,0x10,0x03,0x01,0xF3,0x0A,0x03,0x01,0xE3,0x07,0x03,0x01,0xCD,0x03,0x03,0x01,0xB6,0x00,0x03,
0x02,0xFA,0x48,0x02,0x01,0xFE,0x53,0x04,0x01,0xF8,0x4C,0x04,0x01,0xFA,0x3F,0x03,0x01,0xFA,0x34,0x03,0x01,0xFA,0x26,0x03,0x01,0xFD,0x18,0x03,0x01,0xFB,0x10,0x03,0x01,0xF1,0x0A,0x03,0x01,0xDB,0x07,0x03,0x01,0xC3,0x03,0x03,
0x02,0xFC,0x4A,0x00,0x01,0xFE,0x55,0x02,0x01,0xFA,0x4C,0x02,0x01,0xFA,0x47,0x02,0x01,0xFD,0x3E,0x00,0x01,0xFD,0x33,0x03,0x01,0xFA,0x20,0x03,0x01,0xFC,0x19,0x03,0x01,0xF9,0x10,0x03,0x01,0xE4,0x08,0x03,0x01,0xCC,0x05,0x03,
0x02,0xFC,0x4E,0x00,0x01,0xFE,0x58,0x00,0x01,0xFD,0x50,0x00,0x01,0xFD,0x4D,0x03,0x01,0xFD,0x46,0x03,0x01,0xFD,0x3C,0x00,0x01,0xFD,0x2A,0x03,0x01,0xFC,0x1E,0x03,0x01,0xFD,0x14,0x03,0x01,0xEE,0x0D,0x03,0x01,0xD6,0x07,0x03,
0x02,0xFC,0x54,0x00,0x01,0xFE,0x61,0x00,0x01,0xFD,0x57,0x00,0x01,0xFD,0x53,0x00,0x01,0xFD,0x4D,0x00,0x01,0xFD,0x45,0x00,0x01,0xFD,0x35,0x03,0x01,0xFD,0x27,0x03,0x01,0xFC,0x1B,0x03,0x01,0xF7,0x11,0x03,0x01,0xDE,0x09,0x03,
0x02,0xFC,0x5A,0x00,0x01,0xFE,0x66,0x03,0x01,0xFD,0x5D,0x03,0x01,0xFD,0x57,0x00,0x01,0xFD,0x51,0x00,0x01,0xFD,0x48,0x03,0x01,0xFD,0x38,0x03,0x01,0xFD,0x2A,0x03,0x01,0xFC,0x1E,0x03,0x01,0xFB,0x13,0x03,0x01,0xE7,0x0B,0x03,
0x02,0xFC,0x60,0x00,0x01,0xFE,0x6D,0x03,0x01,0xFC,0x60,0x03,0x01,0xFD,0x5D,0x03,0x01,0xFD,0x53,0x00,0x01,0xFD,0x4A,0x03,0x01,0xFD,0x3F,0x03,0x01,0xFD,0x31,0x03,0x01,0xFD,0x23,0x03,0x01,0xFD,0x14,0x03,0x01,0xEB,0x0A,0x03,
0x02,0xFC,0x64,0x00,0x01,0xFE,0x71,0x03,0x01,0xFD,0x67,0x03,0x01,0xFD,0x61,0x02,0x01,0xFD,0x55,0x00,0x01,0xFD,0x4C,0x00,0x01,0xFD,0x40,0x03,0x01,0xFD,0x32,0x00,0x01,0xFD,0x24,0x03,0x01,0xFC,0x16,0x03,0x01,0xED,0x0D,0x03,
0x02,0xFC,0x66,0x00,0x01,0xFE,0x70,0x02,0x01,0xFD,0x68,0x03,0x01,0xFD,0x63,0x02,0x01,0xFD,0x57,0x00,0x01,0xFD,0x4E,0x00,0x01,0xFD,0x43,0x03,0x01,0xFD,0x34,0x00,0x01,0xFD,0x29,0x03,0x01,0xFC,0x19,0x03,0x01,0xEC,0x0D,0x03,
0x02,0xFC,0x66,0x00,0x01,0xFE,0x72,0x03,0x01,0xFD,0x6A,0x03,0x01,0xFD,0x62,0x02,0x01,0xFD,0x59,0x03,0x01,0xFD,0x51,0x03,0x01,0xFD,0x42,0x00,0x01,0xFD,0x37,0x00,0x01,0xFD,0x29,0x03,0x01,0xFC,0x16,0x03,0x01,0xEC,0x0D,0x03,
0x02,0xFC,0x66,0x00,0x01,0xFE,0x75,0x03,0x01,0xFD,0x6A,0x02,0x01,0xFD,0x60,0x02,0x01,0xFA,0x5B,0x02,0x01,0xFA,0x50,0x03,0x01,0xFD,0x43,0x00,0x01,0xFD,0x34,0x00,0x01,0xFC,0x27,0x03,0x01,0xFD,0x16,0x03,0x01,0xEB,0x0A,0x03,
0x02,0xFC,0x64,0x00,0x01,0xFE,0x71,0x03,0x01,0xFD,0x67,0x03,0x01,0xFD,0x5F,0x03,0x01,0xFA,0x56,0x02,0x01,0xFA,0x4E,0x02,0x01,0xFD,0x40,0x03,0x01,0xFD,0x30,0x03,0x01,0xFC,0x22,0x03,0x01,0xFA,0x15,0x03,0x01,0xE4,0x0B,0x03,
0x02,0xFC,0x60,0x00,0x01,0xFE,0x6B,0x03,0x01,0xFC,0x61,0x03,0x01,0xFD,0x58,0x00,0x01,0xFD,0x50,0x03,0x01,0xFD,0x4B,0x02,0x01,0xFD,0x3C,0x03,0x01,0xFD,0x2D,0x03,0x01,0xFC,0x20,0x02,0x01,0xF9,0x13,0x03,0x01,0xE1,0x09,0x03,
0x02,0xFE,0x60,0x00,0x01,0xFE,0x6D,0x03,0x01,0xFF,0x63,0x03,0x01,0xFF,0x5D,0x03,0x01,0xFF,0x50,0x03,0x01,0xFF,0x49,0x03,0x01,0xFF,0x3B,0x03,0x01,0xFF,0x2B,0x03,0x01,0xFF,0x1C,0x03,0x01,0xFF,0x0E,0x03,0x01,0xEB,0x06,0x03,
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() {
for(int x=0;x<STRIP_WIDTH;x++) {
uint_farptr_t farptr;
if(x==10) {
pinMode(0,OUTPUT);
digitalWrite(0,LOW);
}
if(x % 100 ==0) {
switch(x / 100) {
case 0:
farptr=GET_FAR_ADDRESS(bitmap_0);
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(419);
}
}
I know there is alot of mumbo jumbo script in there, because this code is created by a code generator that writes also for led strips and matrix, but I am not sure if it is to do with the code or with the board. I am using a 9v eveready and the led are plugged into the 5v and gnd of the power section.