#include "ESP8266WiFi.h" #include "ESPAsyncTCP.h" #include "ESPAsyncWebServer.h" #include "FastLED.h" #define FASTLED_ALLOW_INTERRUPTS 0 #define NUM_LEDS 74 #define led_pin 2 #define LED_TYPE NEOPIXEL CRGBArray leds; const char *ssid = "SSID"; const char *password = "PASSWORD"; String theInput = "0"; const char *PARAM_INPUT = "value"; const char index_html[] PROGMEM = R"=====( LED Sign Controller

Select Color

)====="; IPAddress local_ip(192,168,4,4); IPAddress gateway(192,168,4,1); IPAddress subnet(255,255,255,0); AsyncWebServer server(80); void setup(){ pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); delay(10); WiFi.softAP(ssid, password); //NEOPIXEL FastLED.addLeds(leds, NUM_LEDS); WiFi.softAP(ssid, password); WiFi.mode(WIFI_AP); WiFi.softAPConfig(local_ip, gateway, subnet); Serial.print("IP addresse: "); Serial.println(WiFi.localIP()); Serial.println(WiFi.softAPIP()); server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send_P(200, "text/html", index_html); }); server.on("/color", HTTP_GET, [] (AsyncWebServerRequest * request){ String inputMessage; if (request->hasParam(PARAM_INPUT)) { inputMessage = request->getParam(PARAM_INPUT)->value(); convertHextoRGB(inputMessage); Serial.println(inputMessage); delay(5000); convertHextoRGB(inputMessage); } else{ Serial.println("No new color set"); } request->send(200, "text/plain", "OK"); }); server.onNotFound([](AsyncWebServerRequest *request){ request->send(404); }); server.begin(); } void loop(){ digitalWrite(LED_BUILTIN, HIGH); } void convertHextoRGB(String rgbcode){ int pos1 = rgbcode.indexOf('r'); int pos2 = rgbcode.indexOf('g'); int pos3 = rgbcode.indexOf('b'); int red = (rgbcode.substring(pos1+1,pos2)).toInt(); int green = (rgbcode.substring(pos2+1,pos3)).toInt(); int blue = (rgbcode.substring(pos3+1)).toInt(); for(int i=0; i