rgb led
This commit is contained in:
29
RotaxMonitor/lib/led/led.cpp
Normal file
29
RotaxMonitor/lib/led/led.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <led.h>
|
||||
|
||||
RGBled::RGBled(const uint8_t pin, const uint8_t num)
|
||||
{
|
||||
m_led = Adafruit_NeoPixel(num, pin, NEO_GRB + NEO_KHZ800);
|
||||
m_led.begin();
|
||||
m_led.setPixelColor(0, RED);
|
||||
m_led.show();
|
||||
}
|
||||
|
||||
RGBled::~RGBled()
|
||||
{
|
||||
m_led.clear();
|
||||
}
|
||||
|
||||
void RGBled::setStatus(const LedStatus s)
|
||||
{
|
||||
if (m_status == s) return;
|
||||
m_status = s;
|
||||
RGB_BUILTIN_LED_COLOR_ORDER
|
||||
m_led.setPixelColor(0, s);
|
||||
m_led.setBrightness(16);
|
||||
m_led.show();
|
||||
}
|
||||
|
||||
const RGBled::LedStatus RGBled::getSatus(void)
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
Reference in New Issue
Block a user