// Simple program to control an RGB LED light using the Neopixel library
// Adapted from NeoPixel Ring simple sketch (c) 2013 Shae Erisson under the GPLv3
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
int LEDPIN = 6;
// How many NeoPixels are attached to the Arduino?
int NUMPIXELS = 8;
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, LEDPIN, NEO_GRB + NEO_KHZ800);
int delayval = 500; // delay for half a second
void setup() {
pixels.begin(); // This initializes the NeoPixel library.
}
void loop() {
// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(0, pixels.Color(150,0,0)); // red at about 60% of full brightness
pixels.setPixelColor(1, pixels.Color(0,150,0)); // green at about 60% of full brightness
pixels.setPixelColor(2, pixels.Color(0,0,150)); // blue at about 60% of full brightness
pixels.setPixelColor(3, pixels.Color(50,50,50)); // white at about 20% of full brightness
pixels.setPixelColor(4, pixels.Color(0,0,0)); // off
pixels.setPixelColor(5, pixels.Color(25,25,25)); // magenta
pixels.setPixelColor(6, pixels.Color(90,50,170)); //
pixels.setPixelColor(7, pixels.Color(150,50,0)); // orange
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
pixels.setPixelColor(0, pixels.Color(75,0,75)); // magenta at about 60% of full brightness
pixels.setPixelColor(1, pixels.Color(75,75,0)); // yellow at about 60% of full brightness
pixels.setPixelColor(2, 0, 75, 75); // cyan using shorter RGB option at about 60% of full brightness
pixels.setPixelColor(3, 100,100,100); // white using shorter RGB notation at 100% brightness
pixels.setPixelColor(4, 0x661133); // color using shorter HEX color code
pixels.setPixelColor(5, 0x054411); // color using shorter HEX color code
pixels.setPixelColor(6, pixels.ColorHSV(20,100,100)); // color using Hue/Saturation/Value
pixels.setPixelColor(7, pixels.ColorHSV(75,25,25)); // color using Hue/Saturation/Value
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
}