Thanks for your answer
I bought these leds
http://www.adafruit.com/products/322I don't have a clue about programming, really not.
I changed your AtmoDuino.ino into this
#include <FastSPI_LED.h>
//Set the number of leds in the strip.
#define NUM_LEDS
50// Sometimes chipsets wire in a backwards sort of way
struct CRGB { unsigned char b; unsigned char r; unsigned char g; };
// struct CRGB { unsigned char r; unsigned char g; unsigned char b; };
struct CRGB *leds;
#define PIN 4
void setup(){
Serial.begin(115200);
FastSPI_LED.setLeds(NUM_LEDS);
//Change this to match your led strip
FastSPI_LED.setChipset(CFastSPI_LED::SPI_
WS2801);
FastSPI_LED.setDataRate(
1);
//If non-default SPI pins have been used change this.
FastSPI_LED.setPin(PIN,
11,13);
FastSPI_LED.init();
FastSPI_LED.start();
leds = (struct CRGB*)FastSPI_LED.getRGBData();
clearLeds();
}
int readByte(){
while(Serial.available()==0){
FastSPI_LED.stop();
}
FastSPI_LED.start();
return Serial.read();
}
void clearLeds(){
for(int tmpChannel=0; tmpChannel<NUM_LEDS; tmpChannel++){
leds[tmpChannel].r = 0;
leds[tmpChannel].b = 0;
leds[tmpChannel].g = 0;
};
FastSPI_LED.show();
}
void loop(){
if(readByte() == 0xFF){
if(readByte() == 0x00){
if(readByte() == 0x00){
int channels = readByte();
for(int channel=0; channel<channels; channel++){
leds[channel].r = readByte();
leds[channel].b = readByte();
leds[channel].g = readByte();
}
FastSPI_LED.show();
}
}
}
}
here FastSPI_LED.setDataRate(1); the 0 into 1 as discribed here
Note for people using sparkfun's ws2801 led strips - you need to call FastSPI_LED.setDataRate(1) before calling init/start.
The library defaults to a data rate of 0 for ws2801 strips, which is valid for the chips on the 12v strips, but not on the 5v strips (or, at least, the 12v strips that I have here) - it's too fast and you get weird random flashing occuring.
When I try to compile it I get this
AtmoDuino.cpp:1:25: error: FastSPI_LED.h: No such file or directory
AtmoDuino.cpp: In function 'void setup()':
AtmoDuino:13: error: 'FastSPI_LED' was not declared in this scope
AtmoDuino:16: error: 'CFastSPI_LED' has not been declared
AtmoDuino.cpp: In function 'int readByte()':
AtmoDuino:30: error: 'FastSPI_LED' was not declared in this scope
AtmoDuino:32: error: 'FastSPI_LED' was not declared in this scope
AtmoDuino.cpp: In function 'void clearLeds()':
AtmoDuino:42: error: 'FastSPI_LED' was not declared in this scope
AtmoDuino.cpp: In function 'void loop()':
AtmoDuino:55: error: 'FastSPI_LED' was not declared in this scope
uhaaaa I really need help - where do I put the "FastSPI_LED.h" in and what is wrong with the rest. Can you do it for me.
I would really appreciate this.
scorpie