#include "Ledpixel.h" bool st_refresh = true; #if neopixel #include Adafruit_NeoPixel strip1(NUM_LEDS, PIN_STRIP1, NEO_GRBW + NEO_KHZ800); Adafruit_NeoPixel strip2(NUM_LEDS, PIN_STRIP2, NEO_GRBW + NEO_KHZ800); Adafruit_NeoPixel strip3(NUM_LEDS, PIN_STRIP3, NEO_GRBW + NEO_KHZ800); Adafruit_NeoPixel strip4(1, PIN_STRIP4, NEO_GRBW + NEO_KHZ800); #else #include #include "FastLED_RGBW.h" CRGBW strip1[NUM_LEDS]; // FastLED with RGBW CRGB *strip1B = (CRGB *) &strip1[0]; CRGBW strip2[NUM_LEDS]; // FastLED with RGBW CRGB *strip2B = (CRGB *) &strip2[0]; CRGBW strip3[NUM_LEDS]; // FastLED with RGBW CRGB *strip3B = (CRGB *) &strip3[0]; CRGBW strip4[NUM_LEDS]; // FastLED with RGBW CRGB *strip4B = (CRGB *) &strip4[0]; #endif void Ledpixel::begin() { #if neopixel strip1.begin(); strip2.begin(); strip3.begin(); strip4.begin(); #else FastLED.addLeds(strip1B, getRGBWsize(NUM_LEDS)); FastLED.addLeds(strip2B, getRGBWsize(NUM_LEDS)); FastLED.addLeds(strip3B, getRGBWsize(NUM_LEDS)); FastLED.addLeds(strip4B, getRGBWsize(NUM_LEDS)); for(int i=35; i>=0; i--) { strip1[i] = CRGBW(0,0,0,0); strip2[i] = CRGBW(0,0,0,0); strip3[i] = CRGBW(0,0,0,0); } strip4[0] = CRGBW(255,0,0,0); FastLED.show(); #endif } void Ledpixel::refresh() { #if neopixel strip1.show(); strip2.show(); strip3.show(); strip4.show(); #else FastLED.show(); //delay(100); #endif //delay(1000); } void Ledpixel::demo_leds() { for(uint16_t i=0; i=(36-led_number); i--) st_strip( i, 1, 0, 0, 0); } else if (led_number<=72) { for(int i=35; i>=(72-led_number); i--) st_strip( i, 0, 1, 0, 0); } else if (led_number<=108) { for(int i=35; i>=(108-led_number); i--) st_strip( i, 0, 0, 1, 0); } else if (led_number<=144) { for(int i=35; i>=(144-led_number); i--) st_strip( i, 0, 0, 0, 1); } else if (led_number<=180) { for(int i=35; i>=(180-led_number); i--) st_strip( i, 1, 1, 0, 0); } else if (led_number<=216) { for(int i=35; i>=(216-led_number); i--) st_strip( i, 0, 1, 1, 0); } else if (led_number<=252) { for(int i=35; i>=(252-led_number); i--) st_strip( i, 1, 0, 1, 0); } } int led_intensity_ant=0; void Ledpixel::mode2(int led_intensity) { if (abs(led_intensity_ant-led_intensity)<50) { led_intensity_ant=led_intensity; for(int i=0; i20)&& st_refresh) { refresh(); time_refresh_led = millis(); st_refresh = false; } }