5 #ifndef ESPECTROCORE_ESPECTRO_LED_H
6 #define ESPECTROCORE_ESPECTRO_LED_H
12 #include "ESPectro32_Constants.h"
13 #include <RgbLedColor.h>
19 enum ESPectro32_LED_AnimationType {
20 ESPectro_LED_Animation_ON,
21 ESPectro_LED_Animation_OFF,
22 ESPectro_LED_Animation_Blink,
23 ESPectro_LED_Animation_Fading,
24 ESPectro_LED_Animation_Strobo
36 void initPWM(byte pin,
bool activeHigh =
false);
37 void setAnimation(ESPectro32_LED_AnimationType animType, uint32_t speed);
42 this->maxOut_ = maxOut;
54 void setTimeout(
unsigned long timeOut) {
55 animTimeOut_ = timeOut;
64 ESPectro32_LED_AnimationType animationType_ = ESPectro_LED_Animation_OFF;
67 uint32_t refreshMillis_;
68 uint32_t refreshRate_;
69 unsigned long animStartTime_, lastRefreshTime_;
70 unsigned long animTimeOut_ = 30000;
71 bool animating_ =
false;
74 byte numLeds_ = 1, numPins_ = 1;
80 void setAnimationFunc(ESPectro32_LED_AnimationType animType);
82 int getStep(
long t0,
long t,
int v);
83 float getStepFloat(
long t0,
long t,
float v);
98 ESPectro32_LED(uint8_t pin = ESPECTRO32_LED_PIN,
bool activeHigh =
false);
111 void blink(uint32_t interval = 500, uint32_t count = UINT16_MAX);
112 void fade(uint32_t duration = 2000, uint32_t count = UINT16_MAX);
114 void startAnimation();
115 void stopAnimation();
116 bool isAnimating()
const;
117 void setAnimation(ESPectro32_LED_AnimationType animType, uint32_t speed, uint32_t count = UINT16_MAX);
118 void setAnimationTimeout(
unsigned long timeOut);
129 #endif //ESPECTROCORE_ESPECTRO_LED_H
The LED animator.
Definition: ESPectro32_LED.h:30
Represent LED.
Definition: ESPectro32_LED.h:95
void begin()
Must be called first before anything else.
Definition: ESPectro32_LED.cpp:41
void setRefreshRate(int refreshRate)
Definition: ESPectro32_LED.cpp:266
Definition: RgbLedColor.h:96
Definition: RgbLedColor.h:25
Encapsulate a runnable task.
Definition: Task.h:34
void runAsync(void *data)
Body of the task to execute.
Definition: ESPectro32_LED.cpp:314