23 #include "ChaseLEDs.h"
24 #if defined(ARDUINO) && ARDUINO >= 100
75 , _advanceTime(advanceTime)
76 , _lastChange(millis())
78 for (uint8_t index = 0; index < _numPins; ++index) {
79 pinMode(_pins[index], OUTPUT);
80 digitalWrite(_pins[index], LOW);
89 if (_currentIndex >= 0) {
90 if ((millis() - _lastChange) >= _advanceTime) {
92 _currentIndex = (_currentIndex + 1) % _numPins;
93 _lastChange += _advanceTime;
99 _lastChange = millis();
138 digitalWrite(prevPin, LOW);
139 digitalWrite(nextPin, HIGH);
virtual void advance(uint8_t prevPin, uint8_t nextPin)
Advances to the next LED in sequence, turning off prevPin, and turning on nextPin.
uint8_t previousPin(int n) const
Returns the pin that is n steps back in the sequence.
ChaseLEDs(const uint8_t *pins, int num, unsigned long advanceTime)
Initializes the LED chaser.