38 lines
643 B
C++
38 lines
643 B
C++
#include <Adafruit_NeoPixel.h>
|
|
|
|
class MyLed
|
|
{
|
|
public:
|
|
MyLed(int ledPin, int ledCount);
|
|
|
|
void initialize();
|
|
|
|
void setOnState(bool);
|
|
|
|
bool getOnState();
|
|
|
|
void toggle();
|
|
|
|
//! @param brightness in [0, 1]
|
|
void setBrightness(float brightness);
|
|
|
|
//! @param diff in [-1, 1]
|
|
void adjustBrightness(float diff);
|
|
|
|
private:
|
|
|
|
//! Called by public setBrightness. This function
|
|
//! will not store the brightness
|
|
void _setBrightness(float brightness);
|
|
|
|
Adafruit_NeoPixel _strip;
|
|
|
|
float _brightness;
|
|
|
|
bool _isOn;
|
|
|
|
const std::array<float, 3> _defColor;
|
|
|
|
const std::array<float, 3> _color;
|
|
|
|
}; |