PDA

View Full Version : How can I use lpd8806.h and FastSPI_LED.h without interfering?



BambooSam
02-28-2013, 04:54 PM
Hey guys,

I am working on a project where I originally used the fast spi lpd8806.h library to control led strips, I want to keep my original work and continue to build the project using FastSPI_LED.h. They both work fine when the sketch uses either or, but when I call strip.show(); (lpd8806.h) after I use FastSPI_LED.show(); it seems to lock up, so what is causing this? I am guessing its the spi setup, how can I work around this?
I don't have to use the libraries simultaneously, I can basically re-set what ever needs to be re-set before and after I use each library.
Maybe make a public function in each library to set-reset what ever needs to be re-set.
Ex: lpd8806_off(); FastSPI_LED_off(); lpd8806_on(); FastSPI_LED_on();

BambooSam
02-28-2013, 05:54 PM
Got it! :D

If anyone else is in the same boat:



/*This:*/ FastSPI_LED.setChipset(CFastSPI_LED::SPI_LPD8806);
/*This:*/ FastSPI_LED.init();
for(int i=0; i<86; i++){
leds[i].r = 0;
leds[i].g = 0;
leds[i].b = 127;
FastSPI_LED.show();
leds[i].r = 0;
leds[i].g = 0;
leds[i].b = 0;
}

/*This:*/ strip.begin();
for(int i=0; i<86; i++){
strip.p(i, 127, 0, 0);
strip.show();
strip.setPixelColor(i, 0,0,0);
}

dgarcia42
03-04-2013, 06:57 PM
I'm considering building compatibility APIs in a near future release of FastSPI_LED2 so that people can easily move projects from other libraries to FastSPI_LED2 (to make, say, moving from one chipset to another easier). Think there's interest in this?

BambooSam
03-04-2013, 11:26 PM
Probably. Mi issue though is that I needed to keep all of my original code, and the way I talk to the strips is a bit different than with fastSPI_LED. Also fastSPI has a much faster fps than the older lpd8806 library, and I didn't want to deal with slowing the rate down. I am glad I made it work because I am extremely happy with fastSPI_LED!!!