2 #include "MutilaDebug.h" 9 _invertedLogic(invertedLogic),
19 Heartbeat::~Heartbeat()
25 pinMode(_pin, OUTPUT);
39 _offTime = NormalOffMs;
43 _offTime = QuickOffMs;
46 _onTime = QuickerOnMs;
47 _offTime = QuickerOffMs;
55 _offTime = SlowerOffMs;
91 uint32_t wait = _pinState ? _onTime : _offTime;
97 }
else if (_offTime == 0) {
102 }
else if (MillisSince(_lastStateFlip) >= wait) {
103 updatePin(!_pinState);
107 void Heartbeat::updatePin(
bool state)
110 digitalWrite(_pin, _invertedLogic ? !_pinState : _pinState);
111 _lastStateFlip = Millis();
119 t.offTime = _offTime;
void setCustomMode(uint16_t onTime, uint16_t offTime)
void setEnabled(bool on=true)
Heartbeat(const uint8_t pin, const bool invertedLogic=false)
Indicates custom on/off times (set with setCustomMode)