Skip to content

Instantly share code, notes, and snippets.

@thisisjofrank
Last active May 20, 2020 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisisjofrank/e8ae28a9d29e6f158ac9c8a3849ed73a to your computer and use it in GitHub Desktop.
Save thisisjofrank/e8ae28a9d29e6f158ac9c8a3849ed73a to your computer and use it in GitHub Desktop.
Set neopixel LEDs to a single colour using an adafruit feather huzzah
#include <Adafruit_NeoPixel.h> // Include the Neopixel library
#ifdef __AVR__
#endif
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 4
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 256 // Popular NeoPixel ring size
// Set up the NeoPixel library - tell it how many pixels,
// and which pin to use to send signals.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin(); // INITIALIZE NeoPixel strip object
}
void loop() {
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using red
pixels.setPixelColor(i, pixels.Color(255, 0, 0));
pixels.show(); // Send the updated pixel colors to the hardware.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment