// forum.arduino.cc/t/neopixel-lamp-animation-bleed-question/1164836
// референса колец нет. Чёрный цвет почему-то остаётся
// где VCC,GND-источники?
// изучить прогу
#include <Adafruit_NeoPixel.h>
#define PIN 7
#define NUMPIXELS 150 //Исходно было 75
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
int bootUpDelay = 12000 / (NUMPIXELS * 6);
for(int j = 0; j < 6; j++) {
for(int i = 0; i < NUMPIXELS; i++) {
int reversePixel = NUMPIXELS - 1 - i;
if (j == 5) {
strip.setBrightness(255 - (6 * i / NUMPIXELS));
}
strip.setPixelColor(i, strip.Color(255, 255, 255));
strip.setPixelColor(reversePixel, strip.Color(255, 255, 255));
strip.show();
delay(bootUpDelay);
if (!(j == 7 && (i == NUMPIXELS - 1))) {
strip.setPixelColor(i, strip.Color(0, 0, 0));
strip.setPixelColor(reversePixel, strip.Color(0, 0, 0));
}
}
}
strip.setBrightness(255);
}
long firstPixelHue = 0; // Initialized to get full red from Wheel
void loop() {
for(int i = 2; i < NUMPIXELS / 2; i++) {
int reversePixel = NUMPIXELS - 1 - i;
strip.setPixelColor(i, Wheel(firstPixelHue & 65535));
strip.setPixelColor(reversePixel, Wheel(firstPixelHue & 65535));
strip.show();
delay(50);
}
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();
delay(100);
}
firstPixelHue %= 65536; // Reset hue to stay within valid range
}
uint32_t Wheel(uint16_t WheelPos) {
if(WheelPos < 65536 / 3) {
return strip.Color(255, WheelPos * 3 / 256, 0);
} else if(WheelPos < 65536 * 2 / 3) {
WheelPos -= 65536 / 3;
return strip.Color(0, (255 - WheelPos * 2 / 256) / 4, WheelPos / 512);
} else {
WheelPos -= 65536 * 2 / 3;
return strip.Color(WheelPos * 3 / 256, 0, (255 - WheelPos * 3 / 256) / 4);
}
}