diff --git a/software/platformio.ini b/software/platformio.ini index 5be8dc8..1b01db6 100644 --- a/software/platformio.ini +++ b/software/platformio.ini @@ -19,5 +19,6 @@ lib_deps = ; ESP Async WebServer ; AsyncTCP FS - FastLED +; FastLED + https://github.com/samguyer/FastLED.git lib_ignore = ESPAsyncTCP diff --git a/software/src/hardware.h b/software/src/hardware.h index 8136695..802b8dd 100644 --- a/software/src/hardware.h +++ b/software/src/hardware.h @@ -1,11 +1,16 @@ #ifndef _HARDWARE_H #define _HARDWARE_H -#define WIFI_SSID "ssid" -#define WIFI_PASSWORD "password" +#define WIFI_SSID "nether.net" +#define WIFI_PASSWORD "threepwood" #define LED_BUILTIN 13 -static constexpr int SERVO_PINS[] = {5, 18, 24, 25}; +static constexpr int SERVO_PINS[] = {23, 22, 1, 3, 21, 19}; + +static constexpr uint8_t LED_PIN = 4; +static constexpr uint8_t NUM_LEDS = 22; +#define LED_TYPE TM1829 +#define COLOR_ORDER BRG #endif /* _HARDWARE_H */ diff --git a/software/src/led.cpp b/software/src/led.cpp index 8bd2e64..753ba0b 100644 --- a/software/src/led.cpp +++ b/software/src/led.cpp @@ -1,4 +1,8 @@ +#define FASTLED_ALLOW_INTERRUPTS 0 +#include + #include "led.h" +#include "hardware.h" using namespace std; @@ -6,4 +10,15 @@ Led::Led(void) { } void Led::setup(void) { + FastLED.addLeds(leds, NUM_LEDS); + leds[0] = CRGB::Red; + leds[1] = CRGB::Green; + leds[2] = CRGB::Blue; + leds[NUM_LEDS-6] = CRGB::White; + leds[NUM_LEDS-5] = CRGB::White; + leds[NUM_LEDS-4] = CRGB::White; + leds[NUM_LEDS-3] = CRGB::White; + leds[NUM_LEDS-2] = CRGB::White; + leds[NUM_LEDS-1] = CRGB::White; + FastLED.show(); } diff --git a/software/src/led.h b/software/src/led.h index 4cffa06..8e9ce36 100644 --- a/software/src/led.h +++ b/software/src/led.h @@ -1,11 +1,17 @@ #ifndef _LED_H #define _LED_H +#define FASTLED_ALLOW_INTERRUPTS 0 +#include + +#include "hardware.h" + class Led { public: Led(void); void setup(void); private: + CRGB leds[NUM_LEDS]; }; #endif /* _LED_H */ diff --git a/software/src/main.cpp b/software/src/main.cpp index 3c7b9ce..6ed0c1f 100644 --- a/software/src/main.cpp +++ b/software/src/main.cpp @@ -12,6 +12,7 @@ #include "webserver.h" #include "pusher.h" #include "shelf.h" +#include "led.h" volatile SemaphoreHandle_t xPreferencesSemaphore = xSemaphoreCreateMutex(); @@ -19,6 +20,7 @@ Wifi wifi; Webserver webserver; Pusher pusher; Shelf* shelf; +Led led; void setup() { @@ -34,6 +36,7 @@ void setup() // initialize LED digital pin as an output. pinMode(LED_BUILTIN, OUTPUT); + led.setup(); wifi.connect(); shelf = new Shelf(8); pusher.setup();