#include #include #include #include #include #define FONT Font_BOLD #define DISPLAYS_ACROSS 1 #define DISPLAYS_DOWN 1 DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN); const char* ssid = "SKBKIT"; const char* password = "skbkit2024"; WebServer server(80); IPAddress staticIP(10,131,170,4); IPAddress gateway(10,131,170,1); IPAddress subnet(255,255,255,0); String displayText = "Привет из СКБ \"КИТ\""; //String displayText = "Пизда с членом разлучились("; hw_timer_t* timer = NULL; void IRAM_ATTR triggerScan() { dmd.scanDisplayBySPI(); } void reader(){} void setup() { Serial.begin(115200); dmd.selectFont(Font_BOLD); WiFi.begin(ssid, password); //WiFi.config(staticIP, gateway, subnet); if(!WiFi.config(staticIP, gateway, subnet)) { Serial.println("Failed to configure Static IP"); } else { Serial.println("Static IP configured!"); } // if(!SPIFFS.begin()){ // Serial.print("An occurred ERROR"); // log_e("OCCURRED ERROR"); // return; // } while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("\nConnected to WiFi"); Serial.println(WiFi.localIP()); // Обрабатываем GET запрос для главной страницы с формой server.on("/", HTTP_GET, []() { server.send(200, "text/html", "" "" "" "" "Panel text" "" "" "

Введите текст для отображения на экране:

" "
" "" ""); }); // Обрабатываем POST запрос для изменения текста server.on("/api/text", HTTP_POST, []() { if (server.hasArg("text")) { // Получаем текст с формы без преобразования в HTML-сущности displayText = server.arg("text"); } // Отправляем ответ с правильной кодировкой UTF-8 server.send(200, "text/html; charset=UTF-8", "

Text set to:

" + displayText + "

"); }); server.begin(); uint8_t cpuClock = ESP.getCpuFreqMHz(); timer = timerBegin(0, cpuClock, true); timerAttachInterrupt(timer, &triggerScan, true); timerAlarmWrite(timer, 300, true); timerAlarmEnable(timer); dmd.clearScreen(true); } void loop() { server.handleClient(); // Обработка запросов от клиента // Очистка экрана и вывод текста dmd.clearScreen(true); dmd.drawMarquee(displayText.c_str(), displayText.length(), (32 * DISPLAYS_ACROSS) - 1, 0); long start = millis(); long timer = start; boolean ret = false; while (!ret) { if ((timer + 30) < millis()) { ret = dmd.stepMarquee(-1, 0); // Прокрутка текста timer = millis(); } } }