24 #if defined(ARDUINO) && ARDUINO >= 100
66 , _state(initialState)
72 digitalWrite(pin, initialState ? HIGH : LOW);
73 _lastChange = millis();
83 unsigned long currentTime = millis();
85 if ((currentTime - _lastChange) >= _onTime) {
86 digitalWrite(_pin, LOW);
87 _lastChange += _onTime;
91 if ((currentTime - _lastChange) >= _offTime) {
92 digitalWrite(_pin, HIGH);
93 _lastChange += _offTime;
147 if (_state != state) {
148 digitalWrite(_pin, state ? HIGH : LOW);
150 _lastChange = millis();
174 unsigned long currentTime = millis();
176 if ((currentTime - _lastChange) >= _onTime) {
177 digitalWrite(_pin, LOW);
178 _lastChange = currentTime;
182 if ((currentTime - _lastChange) >= _offTime) {
183 digitalWrite(_pin, HIGH);
184 _lastChange = currentTime;
void resume()
Resumes the LED blink cycle after a pause().
unsigned long offTime() const
Returns the number of milliseconds the LED will be off.
void setState(bool state)
Sets the current state of the LED, where true is on, false is off.
void setBlinkRate(unsigned long onTime, unsigned long offTime)
Sets the onTime and offTime (in milliseconds).
bool state() const
Returns the current state of the LED; true is on, false is off.
unsigned long onTime() const
Returns the number of milliseconds the LED will be on.
BlinkLED(uint8_t pin, unsigned long onTime, unsigned long offTime, bool initialState=false)
Initialize a blinking LED on the specified pin.