Skip to content

Instantly share code, notes, and snippets.

@jasonhejna
Created April 26, 2020 01:58
Show Gist options
  • Save jasonhejna/233b5ef05149ec2662e3706847b9a8d0 to your computer and use it in GitHub Desktop.
Save jasonhejna/233b5ef05149ec2662e3706847b9a8d0 to your computer and use it in GitHub Desktop.
// 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>
#define NUMPIXELS 300 // Number of LEDs in strip
// Here's how to control the LEDs from any two pins:
#define DATAPIN 3
#define CLOCKPIN 5
Adafruit_DotStar strip = Adafruit_DotStar(
NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BRG);
// 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.
int j;
void setup() {
strip.begin(); // Initialize pins for output
strip.setBrightness(64);
strip.show(); // Turn all LEDs off ASAP
}
void loop() {
for (j=0; j<=NUMPIXELS; j++) {
strip.setPixelColor(j, 0, 255, 0);
}
strip.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment