#include <Adafruit_NeoPixel.h>
const int ledPins[9] = { 2, 3, 4, 5, 6, 7, 8, 9, 10};
#define PIN 11 // input pin Neopixel is attached to
#define NUMPIXELS 3 // number of neopixels in strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 100; // timing delay in milliseconds
void setup()
{
// ---------------------------------
// Nine white leds
// ---------------------------------
for( int i=0; i<9; i++)
{
pinMode( ledPins[i], OUTPUT);
}
// ---------------------------------
// Three Neopixel leds
// ---------------------------------
pixels.begin();
}
void loop()
{
// ---------------------------------
// Nine white leds
// ---------------------------------
for( int i=0; i<9; i++)
{
digitalWrite( ledPins[i], HIGH); // turn led on
delay( 150);
}
// ---------------------------------
// Three Neopixel leds
// ---------------------------------
for( int j=0; j<20; j++) // a number of times a random color
{
for (int i=0; i < NUMPIXELS; i++)
{
int redColor = random( 0, 256);
int greenColor = random( 0, 256);
int blueColor = random( 0, 256);
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(redColor, greenColor, blueColor));
// This sends the updated pixel color to the hardware.
pixels.show();
// Delay for a period of time (in milliseconds).
delay(delayval);
}
}
// ---------------------------------
// Nine white leds
// ---------------------------------
for( int i=8; i>=0; i--)
{
digitalWrite( ledPins[i], LOW); // turn led off
delay( 150);
}
delay( 500);
}