- #include "config.h"
- #include <SmartLeds.h>
- const int LED_COUNT = 256;
- // SmartLed -> RMT driver (WS2812/WS2812B/SK6812/WS2813)
- SmartLed leds(LED_WS2812, LED_COUNT, WS2812in_2_PIN, 0, DoubleBuffer);
- SmartLed leds2(LED_WS2812, LED_COUNT, WS2812in_PIN, 1, DoubleBuffer);
- int count = 0;
- uint8_t hue;
- void showGradient() {
- hue++;
- // Use HSV to create nice gradient
- for(int i = 0; i != LED_COUNT; i++)
- leds[i] = Hsv{static_cast<uint8_t>(hue + 2 * i), 255, 15};
- leds.show();
- // Use HSV to create nice gradient
- for(int i = 0; i != LED_COUNT; i++)
- leds2[i] = Hsv{static_cast<uint8_t>(hue + 6 * i), 255, 15};
- leds2.show();
- }
- void showRgb() {
- leds[0] = Rgb{50, 0, 0};
- leds[1] = Rgb{0, 50, 0};
- leds[2] = Rgb{0, 0, 50};
- leds[3] = Rgb{0, 0, 0};
- leds[4] = Rgb{50, 50, 50};
- leds.show();
- leds2[0] = Rgb{50, 0, 0};
- leds2[1] = Rgb{0, 50, 0};
- leds2[2] = Rgb{0, 0, 50};
- leds2[3] = Rgb{0, 0, 0};
- leds2[4] = Rgb{50, 50, 50};
- leds2.show();
- }
- void initWS2812b() {
- pinMode(LED_PIN, OUTPUT);
- jsTime.setInterval([]() {
- showGradient();
- },
- 20);
- }
- void refreshWS2812b() {
- }
复制代码
|