diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-11-28 05:45:20 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-12-18 00:00:27 +0300 |
commit | 7bb6daa4bf09947142e38ff468b7f62baae110fd (patch) | |
tree | c120e9ec800525116ad922e6c4cff21064a40538 /platformio/relayctl/src/led.h | |
parent | 16d47968b4938f3b60b97f374d45ad39bb0071b1 (diff) |
esp8266 relay controller wip
Diffstat (limited to 'platformio/relayctl/src/led.h')
-rw-r--r-- | platformio/relayctl/src/led.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/platformio/relayctl/src/led.h b/platformio/relayctl/src/led.h new file mode 100644 index 0000000..ccb3f11 --- /dev/null +++ b/platformio/relayctl/src/led.h @@ -0,0 +1,24 @@ +#pragma once + +#include <Arduino.h> + +namespace homekit { + +class Led { +private: + uint8_t _pin; + +public: + explicit Led(uint8_t pin) : _pin(pin) { + pinMode(_pin, OUTPUT); + off(); + } + + inline void off() const { digitalWrite(_pin, HIGH); } + inline void on() const { digitalWrite(_pin, LOW); } + + void on_off(uint16_t delay_ms, bool last_delay = false) const; + void blink(uint8_t count, uint16_t delay_ms) const; +}; + +}
\ No newline at end of file |