Newbie here. I thought I had it figured out. I got some things to work. However not this.
Arduino Uno R3
The white light goes down the string and back just fine. But the blue does not light the whole string. It has strange behavior. It lights about 2/3 of the string and then some immediately go out so about half the string is lit. Then when the white starts again the blue at the end that wasn't lit lights up. Those blue then get over written by the white as expected. Why don't they all go blue? And why do some go blue but then go out right away?
I hope my code is clear enough.
Thanks
Lee
#include <Adafruit_NeoPixel.h>
#define PIN 2 // input pin Neopixel is attached to
#define NUMPIXELS 200 // number of neopixels in strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// Initialize the NeoPixel library.
pixels.begin();
// clear all
for (int i = 0; i < NUMPIXELS; i++)
{
pixels.setPixelColor(i, pixels.Color(0, 0, 0));
pixels.show();
}
} // end setup
void loop() {
// race forward
// white
for (int j=0; j<2; j++){
for (int i=0; i < NUMPIXELS; i++)
{
pixels.setPixelColor(i, pixels.Color(250, 250, 250));
pixels.setPixelColor(i-1, pixels.Color(0, 0, 0));
pixels.show();
}
// race back
for (int i = NUMPIXELS; i > 0; i = i-1)
{
pixels.setPixelColor(i+1, pixels.Color(0, 0, 0));
pixels.setPixelColor(i, pixels.Color(250, 250, 250));
pixels.show();
}
} // end race
// set all to blue
for (int i=0; i < NUMPIXELS; i++)
{
// green, red, blue
pixels.setPixelColor(i, pixels.Color(0, 0, 250));
pixels.show();
}// end blue
delay (500);
} // end loop
9 posts - 4 participants