If you set up a microcontroller to work with one type of LED (say APA102), is it trivial to change the programming to another (say SK6812)?
Yes, easy to switch. I have a a strip of APA102, LPD8806, and a Neopixel ring that I often use for quick testing. Different types and they are all a different number of pixels too. In the top of lots of my sketches I have the code setup for each and just uncomment/comment the define lines and the addLeds line in the setup section depending on which one I what to plug into my controller and test with.
//#define LED_TYPE APA102
//#define NUM_LEDS 39
//#define COLOR_ORDER BGR
#define LED_TYPE LPD8806
#define NUM_LEDS 32
#define COLOR_ORDER GRB
//#define LED_TYPE NEOPIXEL
//#define NUM_LEDS 12
And then in the setup() section similarly to switch back and forth.
FastLED.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, COLOR_ORDER>(leds, NUM_LEDS);
//FastLED.addLeds<LED_TYPE,DATA_PIN>(leds, NUM_LEDS);
Always code for loops or other parts of code that depend on the length of your strip with the variable NUM_LEDS (instead of hard coding it) and then it’s very easy to switch back and forth.
Thanks very much!
Related Bonus: Hitting ⌘+/ on OS X (CTRL+/ on Windows) will comment or uncomment whole blocks of selected code in the Arduino IDE…