II.3.6. Controlling The LED Indicators
There are two LED indicators in Blackstomp, and we can easily control them through mainLed and auxLed objects. The object has 4 methods for easy and flexible control: turnOn(), turnOff(), blink(), and updateBlink().
- Calling turnOn() method will turn the LED continuously-on, regardless the previous state (already turned-on, turned-off, or blinking).
- Calling turnOff() method will turn the LED continuously-off, regardless the previous state (already turned-off, turned-on, or blinking).
- Calling blink(onPeriod, offPeriod, blinkCount, repeatCount, restPeriod) will start the LED to blink blinkCount times, rest for restPeriod, and repeat the blink cycles repeatCount times. All the parameters are in integer, and all periods is in millisecond unit.
- If the LED is in a blinking state, the new blinking pattern will start immediately to cancel the previous blinking cycle.
- If the blinkCount is zero then the LED will blink forever until turned-off by turnOff() method, disregarding the repeatCount and restPeriod parameters.
- If the repeatCount is zero then the blinking pattern will be repeated forever until turned off by turnedOff() method.
- Calling updateBlink(onPeriod, offPeriod, blinkCount, repeatCount, restPeriod) will update the previous blinking pattern without restarting the blinking state. This method call would do nothing if the the LED is not in a blinking state.