/* RGB Fill Lights Author: tobychui This is the firmware for tobychui's Programmable RGB Fill Light Recommend compiling with following board profiles - Wemos D1 Mini */ #include #include "lib/tempcolor.h" // Hardware Configs #define PIN D4 #define NUM_LEDS 46 #define BUTTON_MODE D7 #define BUTTON_ADD D6 #define BUTTON_COLOR D5 #define BUTTON_MINUS D0 #define BUTTON_AUTOINC_DELAY 500 //Delay before auto increments #define BUTTON_HOLD_DELAY 50 //Auto-increment delays #define MAX_BRIGHTNESS 128 //Make sure the battery you using can output the current required by LEDs #define MAX_CTRLBRIGHTNESS 32 //Max brightness for signaling LED (the one above the button) //Runtimes /* Current Mode 0 = White Mode (+/- Change the K value of the light) 1 = RGB Mode (+/C/- Change the RGB values of the light) 2 = Pure Color Mode (C Change the default color palletes) 3 = Presets Mode (+/- Change the preset profile currently using) */ int currentMode = 0; /* Adjusting Catergory [White Mode] 0 = Color Temperature (K) 1 = Brightness */ int adjustingCatergory = 0; /* Color Values [White Mode] TEMP, Brightness, (un-used) [RGB Mode] R, G, B */ int values[] = {0, 0, 0}; Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800); //Set the current control LED color void setControlLEDColor(int r, int g, int b){ strip.setPixelColor(0, strip.Color(r, g, b)); strip.show(); } //Set the current LED light color by given RGB values void setLightColor(int r, int g, int b) { for (int i = 1; i < NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(r, g, b)); } strip.show(); } void setup() { Serial.begin(115200); //Set the buttons to input pin pinMode(BUTTON_MODE, INPUT); pinMode(BUTTON_ADD, INPUT); pinMode(BUTTON_COLOR, INPUT); pinMode(BUTTON_MINUS, INPUT); strip.begin(); // Initialize all pixels to natural warm white light setColorTemperature(4000, MAX_BRIGHTNESS/2); values[0] = 4000; values[1] = MAX_BRIGHTNESS/2; //Set ctrl LED to low brightness white setControlLEDColor(MAX_CTRLBRIGHTNESS, MAX_CTRLBRIGHTNESS, MAX_CTRLBRIGHTNESS); } void loop() { handleButtonLogic(); }