Hey guys!
I'm trying to figure out how to speed up the movement of this rainbow wave i use with neopixel.
if i register 10 LED's, the wave moves fast, if i register 50 LED's it moves very slow.
Does someone know which Variable i have to change or what to do?
Thank in advance
Regards
DarioCas
#include <Adafruit_NeoPixel.h>
// constants won't change. They're used here to
// set pin numbers:
const int ledPin = 2; // the number of the neopixel strip
const int numLeds = 50;
const int speed = 10;
//Adafruit_NeoPixel pixels = Adafruit_NeoPixel(8, ledPin);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(numLeds, ledPin, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
}
void loop() {
rainbow(0);
}
void rainbow(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i*3+j) & 255));
}
strip.show();
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}