Whew..time constraints!
Here's some code for for the strips in the mean time.
Library is coming....
// Data is clocked out to leds and each LED cascades data to the next LED
// 1 Byte for each LED.
// Bit 7 first , bit 0 last
// bit 7 = Data is latchable.
// bit 6 = Fader double speed
// bits 5-4, 3-2, 1-0 are values for green, red, blue
// meanings as follows:
// * 00 - LED off
// * 01 - LED on (max bright)
// * 10 - LED fade up (start at min bright)
// * 11 - LED fade down (start at max bright)
// eg
// 10010000 = RED on full
// 10110000 = RED on full, then fade down by toggling S pin.
// Set which pins you will use to connect to the LED strip.
#define SIPIN 2
#define DIPIN 3
#define CLKPIN 4
#define LATCHPIN 5
#define LEDS 20 //Set this to the number of LEDs in your strip
// Here is a buffer of values to send to the LEDs
char Display[LEDS];
void setup()
{
Serial.begin(9600);
//Set up our pins to connect to the LED strip.
pinMode(SIPIN, OUTPUT);
pinMode(DIPIN, OUTPUT);
pinMode(CLKPIN, OUTPUT);
pinMode(LATCHPIN, OUTPUT);
digitalWrite(SIPIN, LOW);
digitalWrite(DIPIN, LOW);
digitalWrite(CLKPIN, LOW);
digitalWrite(LATCHPIN, LOW);
}
void SetLed(uint8_t Led, uint8_t Color)
{
//This will send the data to set an individual LED, no effect on any others
//L2ggrrbb
uint8_t i;
uint8_t x;
x = LEDS - Led; //How many to clock out before we send this one
for(i=0 ; i < x ; i++)
{
SendByte(0);
}
// L2ggrrbb
SendByte(Color);
while(i++ < LEDS)
SendByte(0);
latch();
}
void sPulse()
{
//Pulse the S line on the LEDs. This will make any LEDs that are fading do their thing.
//If the double speed bit IS set then two fades will occur. Once each time teh pin is inverted.
digitalWrite(SIPIN, !digitalRead(SIPIN));
delayMicroseconds(1000);
digitalWrite(SIPIN, !digitalRead(SIPIN));
delayMicroseconds(1000);
}
void SendByte(unsigned char it)
{
//Send out one byte, don't forget to LATCH it by calling
//Note that for LARGE number of LEDs you may need to slow things down a little here.
digitalWrite(CLKPIN, LOW);
char x;
for(x=0;x < 8; x++)
{
if(B10000000 & it)
digitalWrite(DIPIN, HIGH);
else
digitalWrite(DIPIN, LOW);
it = it<<1;
digitalWrite(CLKPIN, HIGH);
digitalWrite(CLKPIN, LOW);
}
}
void latch()
{
digitalWrite(LATCHPIN, HIGH);
delayMicroseconds(1); // spec sheet specifies minimum latch pulse of 1us
digitalWrite(LATCHPIN, LOW);
}
void runfader(int y, int d)
{
//Pulse the fader y times with delay d between each pulse
int x;
for(x=0;x<y;x++)
{
digitalWrite(SIPIN, LOW);
delay(d);
digitalWrite(SIPIN, HIGH);
delay(d);
}
}
void SendDisplay()
{
//Send out the global array of bytes and then latch them in
int x=180;
while(x > 0)
{
SendByte( Display[--x]);
}
latch();
}
void setSection(int startled, int endled, char ledvalue)
{
//Set a range of LEDs in the memory buffer.
//Don't forget to call SendDisplay to send the buffer to the LEDs once done!
while(startled <= endled)
{
Display[startled++] = ledvalue;
}
}
void loop()
{
int looper;
SendByte(B10010000);
latch();
delay(20);
// Send a blue LED marching down the strip.
for(looper=0;looper < LEDS;looper++)
{
SendByte(B10000000);
latch();
delay(20);
}
// Set ALL the LEDs in the strip to GREEN, then fade down at double speed.
for(looper=0;looper < LEDS;looper++)
{
SendByte(B11000011);
}
latch();
runfader(64,10);
// Using buffer to create values for LEDs before sending them
setSection(0,LEDS-1,0); //Clear buffer
setSection(0,6, B10010000); //Set a blue section
setSection(7,12, B10000100); //set a red section
setSection(13,LEDS-1,B10000001); //set a green section
SendDisplay(); //send the buffer to the LEDs..voila!
delay(1000);
}