/* * Board: Arduino Mega 2560 * File: Lee_03 * Author: Clive "Max" Maxfield (max@clivemaxfield.com) * License: The MIT License (See full license at the bottom of this file) * * Notes: Simple test program to demo NeoPixels * One pixel races round the ring or down the strip set to one color (let's call it the * 'foreground' color); the pixels "behind" it are set to another color (let's call it * the 'background' color). */ #include // Library for NeoPixels #define pinPix 12 // Pin driving NeoPixel Ring or String #define numPix 16 // Number of NeoPixels in the Ring or Strip #define maskPix 0xF // Sets mask to 0000000000001111 (assumes 16 NeoPixels!!!) // Setup NeoPixel Ring // Parameter 1 = number of pixels in strip // Parameter 2 = pin number driving the strip // Parameter 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) Adafruit_NeoPixel myNeoPixels = Adafruit_NeoPixel(numPix, pinPix, NEO_GRB + NEO_KHZ800); void setup() { myNeoPixels.begin(); // Initialize the NeoPixel array in the Arduino's memory, myNeoPixels.show(); // turn all pixels off, and upload to ring or string } void loop() { letsDoIt(100, 255,255,255, 0,0,0); // Pause; R,G,B foreground; R,G,B background } // Pause = delay between transitions // Rf, Gf, Bf = RGB "Foreground" values // Rb, Gb, Bb = RGB "Background" values void letsDoIt(int pause, byte Rf, byte Gf, byte Bf, byte Rb, byte Gb, byte Bb) { for (int i=0; i