Use the Arduino IDE with the Adafruit DotStar library
Data Pin 1
Clock Pin 0
// Simple strand test for Adafruit Dot Star RGB LED strip. // This is a basic diagnostic tool, NOT a graphics demo...helps confirm // correct wiring and tests each pixel's ability to display red, green // and blue and to forward data down the line. By limiting the number // and color of LEDs, it's reasonably safe to power a couple meters off // the Arduino's 5V pin. DON'T try that with other code! #include <Adafruit_DotStar.h> // Because conditional #includes don't work w/Arduino sketches... //#include <SPI.h> // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET #include <avr/power.h> // ENABLE THIS LINE FOR GEMMA OR TRINKET #define NUMPIXELS 24 // Number of LEDs in strip // Here's how to control the LEDs from any two pins: #define DATAPIN 1 //4 #define CLOCKPIN 0 //3 Adafruit_DotStar strip = Adafruit_DotStar( NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BGR); // The last parameter is optional -- this is the color data order of the // DotStar strip, which has changed over time in different production runs. // Your code just uses R,G,B colors, the library then reassigns as needed. // Default is DOTSTAR_BRG, so change this if you have an earlier strip. // Hardware SPI is a little faster, but must be wired to specific pins // (Arduino Uno = pin 11 for data, 13 for clock, other boards are different). //Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DOTSTAR_BRG); int delayval = 30; // delay for 1 ms void setup() { #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L) clock_prescale_set(clock_div_1); // Enable 16 MHz on Trinket #endif strip.begin(); // Initialize pins for output strip.show(); // Turn all LEDs off ASAP } void loop() { for(int i=NUMPIXELS; i>-1; i--){ strip.setPixelColor(i, strip.Color(255, 0, 0)); // pixels.Color takes RGB values in GRB format, 0,0,0 to 255,255,255 strip.show(); delay(delayval); } for(int i=0; i<NUMPIXELS; i++){ strip.setPixelColor(i, strip.Color(0, 255, 0)); strip.show(); delay(delayval); } for(int i=NUMPIXELS; i>-1; i--){ strip.setPixelColor(i, strip.Color(0, 0, 255)); strip.show(); delay(delayval); } for(int i=0; i<NUMPIXELS; i++){ strip.setPixelColor(i, strip.Color(255, 0, 125)); strip.show(); delay(delayval); } for(int i=NUMPIXELS; i>-1; i--){ strip.setPixelColor(i, strip.Color(0, 255, 125)); strip.show(); delay(delayval); } for(int i=0; i<NUMPIXELS; i++){ strip.setPixelColor(i, strip.Color(255, 100, 0)); strip.show(); delay(delayval); } for(int i=NUMPIXELS; i>-1; i--){ strip.setPixelColor(i, strip.Color(255, 125, 125)); strip.show(); delay(delayval); } }