Add a timer to turn off after a period of time. Move the LED name to reduce string literals.

This commit is contained in:
Robert Marshall 2021-08-27 09:02:35 +01:00
parent 59ec76b52f
commit c3e91d269e
5 changed files with 93 additions and 12 deletions

View file

@ -4,7 +4,8 @@
#include <Arduino.h>
#include "LEDOutput.cpp"
class LED{
class LED {
std::string _name;
LEDOutput* _output;
bool _on;
unsigned long _fadeDurationOn, _fadeDurationOff, _fadeStart, _fadeEnd;
@ -39,13 +40,18 @@ class LED{
}
public:
LED(LEDOutput* output, unsigned long fadeDurationOn, unsigned long fadeDurationOff) {
LED(std::string name, LEDOutput* output, unsigned long fadeDurationOn, unsigned long fadeDurationOff) {
_name = name;
_output = output;
_fadeDurationOn = fadeDurationOn;
_fadeDurationOff = fadeDurationOff;
_brightness = 1.0f;
}
std::string getName(){
return _name;
}
void on(){
reset(true);
}