I am currently building a lamp to get back into arduino.
The Neopixel lamp starts with a boot up sequence of 2 white pixels, which transform into two 2red pixels moving.. I want the two red pixels transition seemlessly into the mood wheel.
How can I archieve this ? I dont understand how I can change the color of the mood wheel sequence to start with red - or the movement of the 2 red pixels moving "into" the mood wheel sequence.
I appreciate any help with loooooooooove since this is the final step id like to understand for this project.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.
In this loop, strip.show(); is displaying the "fade" all at one time, after all the colors have been assigned... you should move strip.show();inside the loop so the colors are displayed as each color is assigned...
for(; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
for(int i = 0; i < strip.numPixels(); i++) {
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
strip.setPixelColor(i, Wheel(pixelHue & 65535));
strip.show(); // <-- HERE IT IS INSIDE THE LOOP
}
delay(100);
}
Thanks @xfpd for providing the Wokwi simulation, that makes the idea much more "visible"!
One thing that could be removed is this if-clause in setup():
if (!(j == 7 && (i == NUMPIXELS - 1))) {
strip.setPixelColor(i, strip.Color(0, 0, 0));
strip.setPixelColor(reversePixel, strip.Color(0, 0, 0));
}
As j is controlled by this line only
for(int j = 0; j < 6; j++) {
it will never reach 7. Therefore (j == 7) will always be false and !(j == 7 && ...) will always be true. It's not very important but makes the start routine more readable.
If the brightness shall significantly drop in the last sweep (j ==5) the factor 6 in
this part in setup() might be more effective if changed to 255:
for (int i = 0; i < NUMPIXELS; i++) {
int reversePixel = NUMPIXELS - 1 - i;
if (j == 5) {
strip.setBrightness(255 - (6 * i / NUMPIXELS));
}
Not sure if this is intented ...
Anyway I used your work on Wokwi to test the changes: