How to write a APA 102c test program in C Programming Language ?
Solution:
// This #include statement was automatically added by the Particle IDE.
#include "FastLED/FastLED.h"
FASTLED_USING_NAMESPACE;
// How many leds in your strip?
#define NUM_LEDS 86
#define DATA_PIN A5 // FOR BREADBORD STRIP RUNNING WITH APA102C
#define CLOCK_PIN A3 // FOR BREADBORD STRIP RUNNING WITH APA102C
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, BGR>(leds, NUM_LEDS);
}
void loop() {
for (int i=0;i<10;i++){
fill_solid( &(leds[0]), NUM_LEDS, CRGB(i,0,0)); // test brightness control
leds[i]=CRGB::Magenta; // show index information n'th led in strip
leds[i]%=6;
FastLED.show();
delay(1000);
}
for (int i=0;i<10;i++){
fill_solid( &(leds[0]), NUM_LEDS, CRGB(0,i,0));
leds[i]=CRGB::CornflowerBlue; // we have hardware fight club here
leds[i]%=6;
FastLED.show();
delay(1000);
}
for (int i=0;i<10;i++){
fill_solid( &(leds[0]), NUM_LEDS, CRGB(0,0,i));
leds[i]=CRGB::Yellow;
leds[i]%=6;
FastLED.show();
delay(1000);
}
}