RGB Addressable LEDs

Some Sparkfun Addressable LEDs, being controlled via Adafruits neopixel library.

#include <Adafruit_NeoPixel.h>

#define PIN 4
#define LED_COUNT 5

int x;
uint32_t colors[5];

// Create an instance of the Adafruit_NeoPixel class called "leds".
// That'll be what we refer to from here on...
Adafruit_NeoPixel leds = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);

void setup() {

 colors[0] = leds.Color(150,0,0);
 colors[1] = leds.Color(0,150,0);
 colors[2] = leds.Color(0,0,150);
 colors[3] = leds.Color(150,0,150);
 colors[4] = leds.Color(150,150,0);


void loop() {
  leds.setPixelColor(x, colors[x] );

  if (x > 4) { x = 0;}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s