Pomoc w poprawie kodu - Wersja do druku +- Arduino Polska Forum (https://forum.arduinopolska.pl) +-- Dział: Korzystanie z Arduino (https://forum.arduinopolska.pl/dzial-korzystanie-z-arduino) +--- Dział: Instalacja i rozwiązywanie problemów (https://forum.arduinopolska.pl/dzial-instalacja-i-rozwi%C4%85zywanie-problem%C3%B3w) +--- Wątek: Pomoc w poprawie kodu (/watek-pomoc-w-poprawie-kodu) |
Pomoc w poprawie kodu - Gibcio2020 - 12-09-2021 Siemka w końcu udało mi się dogrzebać do kodu dzięki któremu mogę przesyłać obraz do aplikacji w telefonie jednak stanąłem na włączeniu LED'a podczas przesyłania obrazu oto kod, proszę o pomoc #include <WiFiClient.h> #include <WebServer.h> #include <WiFi.h> #include <esp32cam.h> const char *ssid = "***"; const char *password = "***"; WebServer server(1030); static auto loRes = esp32cam::Resolution::find(320, 240); unsigned long aktualnyCzas = 0; unsigned long zapamietanyCzasCam = 0; void MainPage() { String Page = ""; Page += "<html>"; Page += "<head>"; Page += "</head>"; Page += "<body>"; Page += "Witaj na mojej stronie<br><br>"; Page += "</body>"; Page += "</html>"; server.send(200, "text/html", Page); } void handleNotFound() { String message = "Nie znaleziono strony !"; server.send(404, "text/plain", message); } void camera() { WiFiClient client = server.client(); auto startTime = millis(); int res = esp32cam::Camera.streamMjpeg(client); auto duration = millis() - startTime; server.send(200, "text/html", "Kamerka działa !"); } void flash_on() { digitalWrite(FLASH, HIGH); server.send(200, "text/html", "Lampa wlaczona !"); } void flash_off() { digitalWrite(FLASH, LOW); server.send(200, "text/html", "Lampa wylaczona !"); } void setup() { pinMode(FLASH, OUTPUT); Serial.begin(115200); { using namespace esp32cam; Config cfg; cfg.setPins(pins::AiThinker); cfg.setResolution(loRes); cfg.setBufferCount(5); cfg.setJpeg(80); bool ok = Camera.begin(cfg); } WiFi.persistent(false); WiFi.mode(WIFI_AP_STA); WiFi.begin(ssid, password); Serial.println(""); while(WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.print("Polaczylem sie z: "); Serial.println(ssid); Serial.print("Uzyj adresu: "); Serial.print("http://"); Serial.print(WiFi.localIP()); Serial.println("/"); server.on("/", MainPage); server.on("/camera", camera); server.on("/flash_on", flash_on); server.on("/flash_off", flash_off); server.onNotFound(handleNotFound); server.begin(); Serial.println("Start serwera"); } void loop() { server.handleClient(); } RE: Pomoc w poprawie kodu - Gibcio2020 - 14-09-2021 Problem rozwiązany działa jak tralala |