Wemos D1 Mini Frimware zur Steuerung einer RGBW-LED-Lampe
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

LEDStripManager.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef LEDSTRIPEMANAGER_H
  2. #define LEDSTRIPEMANAGER_H
  3. #include "Arduino.h"
  4. #include <Adafruit_NeoPixel.h>
  5. #include <WebSocketsServer.h>
  6. #include "ConfigManager.h"
  7. #include "LEDModes.h"
  8. const int LED_STRIP_POWER_PIN = D2; // The pin to switch on / off the LED stripe
  9. const int LED_STRIP_DATA_PIN = D8; // The pin to switch control the LED stripe
  10. class LEDStripManager {
  11. public:
  12. LEDStripManager(uint16_t numLeds, uint8_t pin, ConfigManager &configManager, WebSocketsServer &webSocket);
  13. virtual ~LEDStripManager();
  14. void begin();
  15. void clear();
  16. void show();
  17. void on();
  18. void off();
  19. bool isOn();
  20. void setBrightness(uint8_t brightness);
  21. void setPixel(uint16_t index, uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
  22. void setAll(uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
  23. void rainbow();
  24. void setSegments();
  25. void flash();
  26. void doSpectral();
  27. void fade();
  28. void onModeChange(LEDModes mode);
  29. void onColorChange(String cfgVal, uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
  30. void onBrightnessChange(uint8_t brightness);
  31. void onCfgParamChange(String cfgVal, uint32_t amount);
  32. private:
  33. Adafruit_NeoPixel strip;
  34. ConfigManager &configManager;
  35. WebSocketsServer &webSocket;
  36. uint32_t firstPixelHue = 0;
  37. uint32_t wheel(uint8_t pos);
  38. };
  39. #endif