| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #ifndef LEDSTRIPEMANAGER_H
- #define LEDSTRIPEMANAGER_H
-
- #include "Arduino.h"
- #include <Adafruit_NeoPixel.h>
- #include <WebSocketsServer.h>
- #include "ConfigManager.h"
- #include "LEDModes.h"
-
- const int LED_STRIP_POWER_PIN = D2; // The pin to switch on / off the LED stripe
- const int LED_STRIP_DATA_PIN = D8; // The pin to switch control the LED stripe
-
- class LEDStripManager {
-
- public:
- LEDStripManager(uint16_t numLeds, uint8_t pin, ConfigManager &configManager, WebSocketsServer &webSocket);
- virtual ~LEDStripManager();
-
- void begin();
- void clear();
- void show();
- void on();
- void off();
- bool isOn();
- void setBrightness(uint8_t brightness);
- void setPixel(uint16_t index, uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
- void setAll(uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
- void rainbow();
- void setSegments();
- void flash();
- void doSpectral();
- void fade();
- void onModeChange(LEDModes mode);
- void onColorChange(String cfgVal, uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
- void onBrightnessChange(uint8_t brightness);
- void onCfgParamChange(String cfgVal, uint32_t amount);
-
- private:
- Adafruit_NeoPixel strip;
- ConfigManager &configManager;
- WebSocketsServer &webSocket;
-
- uint32_t firstPixelHue = 0;
- uint32_t wheel(uint8_t pos);
- };
-
- #endif
|