31 lines
684 B
C++
31 lines
684 B
C++
#ifndef LED_CONTROLLER_H
|
|
#define LED_CONTROLLER_H
|
|
|
|
#include <Arduino.h>
|
|
|
|
class LEDController {
|
|
private:
|
|
const int _ledPin;
|
|
bool _state;
|
|
bool _isBlinking;
|
|
unsigned long _previousMillis;
|
|
unsigned long _blinkInterval;
|
|
unsigned long _blinkCount;
|
|
|
|
public:
|
|
LEDController(int ledPin);
|
|
LEDController(int ledPin, bool state);
|
|
void turnOn();
|
|
void turnOff();
|
|
void toggle();
|
|
bool getState() const;
|
|
void blink(bool enable);
|
|
bool isBlinkingEnabled() const;
|
|
void interval(unsigned long interval);
|
|
unsigned long getBlinkInterval() const;
|
|
unsigned long getBlinkCount() const;
|
|
void tick();
|
|
void set(bool value);
|
|
};
|
|
|
|
#endif |