Skip to content

Instantly share code, notes, and snippets.

Last active May 20, 2020 10:40
What would you like to do?
Set neopixel LEDs to a single colour using an adafruit feather huzzah
#include <Adafruit_NeoPixel.h> // Include the Neopixel library
#ifdef __AVR__
// 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));; // 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