#include <FastLED.h>
#define NUM_LEDS 25
#define DATA_PIN 21
CRGB leds[NUM_LEDS];
void setup() {
//Serial.begin(115200);
//Serial.println("Start ...");
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS).setCorrection(UncorrectedColor);
FastLED.setBrightness(getBrightCRT(255));
//FastLED.setMaxPowerInVoltsAndMilliamps(5, 5000);
//FastLED.setDither(0);
//FastLED.setMaxRefreshRate(100);
}
void loop() {
EVERY_N_MILLISECONDS(40) {
//mode_snake();
//mode_snake2();
mode_sparcle1();
leds[NUM_LEDS - 1] = 0xff0000; // хвост
FastLED.show();
}
}
byte getBrightCRT(byte val) {
return ((long)val * val * val + 130305) >> 16;
}
void mode_snake2() {
static uint16_t _offset;
EVERY_N_MILLISECONDS(20) {
_offset--;
// if (_offset ) _offset = 0;
}
#define LOW_P 155
for (int i = 0; i < NUM_LEDS; i++) {
{
uint8_t _s = triwave8((i * 10) + _offset);
if (_s < LOW_P) _s = LOW_P;
_s = map(_s, LOW_P, 255, 0, 255);
//map(value, fromLow, fromHigh, toLow, toHigh)
leds[i] = CHSV((_s / 3) + 160, 200, _s);
//leds[i].r = _s;
//leds[i].g = _s;
//leds[i].b = _s;
}
}
//blur1d(leds, NUM_LEDS, 33);
//fadeToBlackBy(leds, NUM_LEDS, 5);
}
void mode_sparcle1()
{
EVERY_N_MILLISECONDS(500) {
leds[random16(NUM_LEDS-1)]=CHSV(random8(),255,255);
}
leds[NUM_LEDS - 1] = 0x000000;
blur1d(leds, NUM_LEDS, 128);
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
neopixels:DOUT
neopixels:VDD
neopixels:VSS
neopixels:DIN