2026-5-5 21:07:18 [显示全部楼层]
6浏览
查看: 6|回复: 0

[求助] 求大佬们帮忙,k10和esp32之间的无线连接问题

[复制链接]
我想利用FireBeetle 2 ESP32-S3开发板和附带一个OV2640摄像头,以及k10。实现让开发板开启热点,k10无线连接这个热点并实时显示OV2640摄像头的视频。现在esp32的程序已经做好了,但是k10怎么也连不上去。显示不了画面。求大佬们看看哪里出问题了。下面的是esp32的程序。k10的程序做不出来。上传模式里面没有相应的模块。#include "DFRobot_AXP313A.h"DFRobot_AXP313A axp;

#include <Arduino.h>
#include "esp_camera.h"
#include <WiFi.h>
#include "board_config.h"

const char *ssid = "K10_CAM";
const char *password = "12345678";

WiFiServer server(80);

void setup() {
  while(axp.begin() != 0){ delay(1000); }
  axp.enableCameraPower(axp.eOV2640);

  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();

  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sccb_sda = SIOD_GPIO_NUM;
  config.pin_sccb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 16000000;

  config.frame_size = FRAMESIZE_QVGA;
  config.pixel_format = PIXFORMAT_JPEG;
  config.grab_mode = CAMERA_GRAB_LATEST;
  config.fb_location = CAMERA_FB_IN_PSRAM;
  config.jpeg_quality = 15;
  config.fb_count = 1;

  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {
    Serial.printf("Camera init failed with error 0x%x", err);
    return;
  }

  sensor_t *s = esp_camera_sensor_get();

  // ----------------- 画面方向(已经正确)
  s->set_vflip(s, 0);
  s->set_hmirror(s, 0);

  // ----------------- 解决 波纹 + 偏暗 + 偏绿(通用函数,100%不报错)
  s->set_brightness(s, 2);   // 提亮
  s->set_contrast(s, 1);     // 对比度
  s->set_saturation(s, 1);   // 色彩
  s->set_awb_gain(s, 1);     // 自动白平衡(去绿色)
  s->set_gain_ctrl(s, 1);    // 自动增益
  s->set_exposure_ctrl(s, 1);// 自动曝光
  s->set_lenc(s, 1);         // 去波纹
  s->set_bpc(s, 1);

  // ----------------- WiFi
  WiFi.softAP(ssid, password);
  IPAddress apIP = WiFi.softAPIP();
  Serial.println("WiFi 热点已开启!");
  server.begin();

  Serial.print("Camera Ready! Use http://");
  Serial.print(apIP);
  Serial.println(" to connect");
}

void loop() {
  WiFiClient client = server.accept();
  if (!client) return;

  String req = client.readStringUntil('\n');
  client.flush();

  if (req.indexOf("GET /") >= 0) {
    client.println("HTTP/1.1 200 OK");
    client.println("Content-Type: multipart/x-mixed-replace; boundary=frame");
    client.println();

    while (client.connected()) {
      camera_fb_t *fb = esp_camera_fb_get();
      if (!fb) break;

      client.println("--frame");
      client.println("Content-Type: image/jpeg");
      client.println("Content-Length: " + String(fb->len));
      client.println();
      client.write(fb->buf, fb->len);
      client.println();

      esp_camera_fb_return(fb);
    }
  }

  client.stop();
}



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4 备案 沪公网安备31011502402448

© 2013-2026 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail