//METHODS void LEDS::setup(int numberLeds) { _ledStrip = LPD6803(numberLeds, DATAPIN, CLOCKPIN); // Set the first variable to the NUMBER of pixels. 20 = 20 pixels in a row ledStripInit(); }
#include "Leds.h" LPD6803 _ledStrip = LPD6803(NUMLEDS, DATAPIN, CLOCKPIN); // Set the first variable to the NUMBER of pixels. 20 = 20 pixels in a row //int _pillarHead = 0; //int _pillarLength = 4; //unsigned int _pillarColor; uint16_t color1; uint16_t color2; boolean _flagRainbow = false; // true := rainbow() //DESTRUCTOR// LEDS::~LEDS() { } //METHODS void LEDS::setup(int numberLeds) { _ledStrip = LPD6803(numberLeds, DATAPIN, CLOCKPIN); // Set the first variable to the NUMBER of pixels. 20 = 20 pixels in a row
#define dataPin 2 #define clockPin 3 // the number of LED/WS2801 pairs; must be in the range [1, 2**8) #define stripLength 49 // specified under `rate` in the `[device]` section of /etc/boblight.conf #define serialRate 19200 // boblightd sends a prefix (defined in /etc/boblight.conf) before sending the pixel data uint8_t prefix[] = {0x55, 0xAA}; // Set the first variable to the NUMBER of pixels. 20 = 20 pixels in a row // WS2801 strip = WS2801(stripLength, dataPin, clockPin); LPD6803 strip = LPD6803(stripLength, dataPin, clockPin); void setup() { // The Arduino needs to clock out the data to the pixels // this happens in interrupt timer 1, we can change how often // to call the interrupt. setting CPUmax to 100 will take nearly all all the // time to do the pixel updates and a nicer/faster display, // especially with strands of over 100 dots. // (Note that the max is 'pessimistic', its probably 10% or 20% less in reality) strip.setCPUmax(50); // start with 50% CPU usage. up this if the strand flickers or is slow // initialise our LED strip strip.begin(); // make the first pixel red as an indicator that it is awaiting data strip.setPixelColor(0, 10, 0, 0);