No description
  • C++ 81.4%
  • C 10.2%
  • HTML 6.5%
  • Sass 1.9%
Find a file
2023-03-04 17:03:29 +01:00
data connected output fix 2021-06-24 22:22:09 +02:00
include Fix compile 2023-03-04 16:57:46 +01:00
instructions fixed broken links 2022-03-01 12:03:30 +01:00
lib Begin PlattformIO transition 2023-02-19 22:14:25 +01:00
src Fix compile 2023-03-04 16:57:46 +01:00
test Begin PlattformIO transition 2023-02-19 22:14:25 +01:00
.gitignore Begin PlattformIO transition 2023-02-19 22:14:25 +01:00
doxygenConfig Upgrade config 2023-03-04 17:03:29 +01:00
platformio.ini Fix compile 2023-03-04 16:57:46 +01:00
Readme.md fixed broken links 2022-03-01 12:03:30 +01:00

ESP8266 LED-Controller

This project is a led controller for esp8266 (esp32 support will follow some day). It works with analog led stripes. It supports some LEDModes out of the box. E.g. Static Color, Faded Colors or Sound Reactive Colors. The project aims to support simple addition of own led modes to do so check Add own LEDMode.

Installation & Usage

If you want to use this project you just need to clone it and edit the defines.h file to match your GPIO pins. If you don't have a microphone just remove the line. After adjusting the defines you can flash the software to the microcontroller. After flashing you need to upload the files inside of the data directory to the controller. The controller uses LitlleFS. If you skip this step you wont be able to connect the controller to a wifi network.

Add own LEDMode

To add a new LEDMode you need to create a new class which inherits the LEDMode base class. You need to overwrite void handleMode() and void configMode(DynamicJsonDocument &configData). The first one is called every loop to handle e.g. changing colors to an event (see FadeMode.h/cpp). The second one is called if a WebSocket event on the config channel is received and the configuration is not a generic one for the controller. See instructions/basicInstructions.md Configure the Controller for more info.

The following example creates an led mode with the name MYLEDMODE. Every loop it will check for the myOwnModeVar. If it is true it will send a message to the LEDController to set the color to myColor. Otherwise it will set the color to off.


#include "RGBColor.h"
#include "LEDMode.h"

class MyLedMode : public LEDMode
{
private:
    bool myOwnModeVar;
    RGBColor myColor;
public:
    
    MyLedMode() : LEDMode("MYLEDMODE"), myOwnModeVar(true), myColor(RGBColor(255, 186, 3)) {}

    void handleMode() override 
    {
        if(this->myOwnModeVar) {
            LEDModeUpdateMSG msg(LEDModeUpdateMSG::UpdateType::COLOR, this->myColor);
            LEDMode::notify(msg);
        }else {
            LEDModeUpdateMSG msg(LEDModeUpdateMSG::UpdateType::COLOR, LEDController::offColor);
            LEDMode::notify(msg);
        }
    }
    
    void configMode(DynamicJsonDocument &configData) override {}

    void myOwnMethod() 
    {
        this->myOwnModeVar = !this->myOwnModeVar;
    }
}