summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-10-12 06:27:58 +0200
committerJonas Smedegaard <dr@jones.dk>2023-10-12 06:27:58 +0200
commit06338488691c33f8ab98b43d8e474075bb6212ea (patch)
tree368cb40676daacff2c3779f4387b4ce1131c82a6
parent365eed1fc619b2b658facfd10ff8e81b64bdf84e (diff)
integrate led strip functionality
-rw-r--r--main.ino19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.ino b/main.ino
index e5566de..6ce93d2 100644
--- a/main.ino
+++ b/main.ino
@@ -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)