Wemos D1 Mini Frimware zur Steuerung einer RGBW-LED-Lampe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LEDStripManager.h 1.1KB

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