diff options
-rw-r--r-- | main.ino | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -31,6 +31,9 @@ BlinkControl led(LED_BUILTIN); // pin 13 is built-in LED on many Arduino boards #define SERVO_PIN 3 #endif +#define LEDS_PIN 6 +#define LEDS_AMOUNT 10 + // serial port speed #define BAUDRATE 115200 @@ -38,6 +41,10 @@ EasyButton button_move(BUTTON_PIN_MOVE); EasyButton button_select(BUTTON_PIN_SELECT); EasyButton button_action(BUTTON_PIN_ACTION); +#include <FastLED.h> + +CRGB leds[LEDS_AMOUNT]; + #if defined(HAS_DISPLAY) #define ENABLE_GxEPD2_GFX 0 @@ -103,6 +110,7 @@ void setup() { led.begin(); led.breathe(2000); + FastLED.addLeds<NEOPIXEL, LEDS_PIN>(leds, LEDS_AMOUNT); #if defined(HAS_DISPLAY) displayEPaper.init(115200, true, 2, false); @@ -164,6 +172,17 @@ void onButtonActionPressed() { Serial.println("button ACTION clicked"); led.fastBlinking(); servo_should_move = 1; + rolling_green(); +} + +void rolling_green() { + for (int dot = 0; dot < LEDS_AMOUNT; dot++) { + leds[dot] = CRGB::Green; + FastLED.show(); + // clear this LED for the next time around the loop + leds[dot] = CRGB::White; + delay(60); + } } #if defined(HAS_DISPLAY) |