I'm build a smart night light for my son using Neopixels. I have 8 WS2812B individual Neopixels daisy chained in my 3D printed housing being controlled by an Adafruit 5V Trinket with an external battery supply for lights.
See it in action here:
https://vimeo.com/89469312
Each letter has two lights, and the order of the Neopixels goes like this per letter of his name goes like this:
O - 1, 2
W - 3, 4
E - 5, 0
N - 6, 7
This code block lights a random Neopixel to a random colour. This works fine. All lights start off, then get light up randomly until they are all on.
Code: Select all
#include <Adafruit_NeoPixel.h>
#define PIN 0
#define MAXLED 8
#define MAXCOLOR 255
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(8, PIN);
void setup() {
pixels.begin();
pixels.setBrightness(83); // 1/3 brightness
pixels.show();
//shadesOfBlue();
}
void shadesOfBlue() {
pixels.setPixelColor(1, 104, 131, 139);
pixels.setPixelColor(2, 104, 131, 139);
pixels.setPixelColor(3, 154, 192, 205);
pixels.setPixelColor(4, 154, 192, 205);
pixels.setPixelColor(5, 178, 223, 238);
pixels.setPixelColor(0, 178, 223, 238);
pixels.setPixelColor(6, 191, 239, 255);
pixels.setPixelColor(7, 191, 239, 255);
}
void loop() {
int16_t i = random(MAXLED);
int16_t r = random(MAXCOLOR);
int16_t g = random(MAXCOLOR);
int16_t b = random(MAXCOLOR);
pixels.setPixelColor(i, r, g, b);
pixels.show();
delay(200);
}
Is there something obvious I'm missing here?