ESP32 做Web服务器 http Server步骤

本文介绍了如何使用ESP32创建一个HTTP Web服务器。首先,通过连接到WiFi网络,然后利用ESPAsyncWebServer库来实现。在找不到相关资源的情况下,作者参考了DFRobot的博客和GitHub项目,详细步骤包括安装PlatformIO IDE,新建工程,以及在项目配置中添加ESP Async WebServer库。通过这些步骤,成功地在ESP32上运行了Web服务器。

资料不多。多是国外网站的。

百度搜基本出来的是这个网站https://www.dfrobot.com/blog-922.html

出来的代码是:

#include <WiFi.h>
#include <FS.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
 
const char* ssid = "yourNetworkName";
const char* password =  "yourNetworkPassword";
 
AsyncWebServer server(80);
 
void setup(){
  Serial.begin(115200);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }
 
  Serial.println(WiFi.localIP());
 
  server.on("/html", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(200, "text/html", "<p>This is HTML!</p>");
  });
 
&nb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值