|
50黑幣
- #include<ESP8266WiFi.h>
- #include<ESPAsyncTCP.h>
- #include<ESPAsyncWebServer.h>
- #include "setting.h"
- AsyncWebServer server(80);
- const char * MESSAGE = "HELLOW,WORLD!";
- const char * MESSAGE2 = "message2!";
- void notFound(AsyncWebServerRequest *request)
- {
- request->send(404,"text/plain","Not found");
- }
- void setup()
- {
- Serial.begin(115200);
- connect_to_wifi();
- server.on("/",HTTP_GET,[](AsyncWebServerRequest *request){
- request->send(200, "text/plain", "Hello World");
- });
- server.on("/get",HTTP_GET,[](AsyncWebServerRequest *request){
- request->send(200,"text/plain",MESSAGE2);
- });
- server.onNotFound(notFound);
- //啟動(dòng)web服務(wù)器
- server.begin();
- }
- void loop()
- {
- }
復(fù)制代碼 |
-
-
代碼文件.rar
2021-1-15 17:06 上傳
點(diǎn)擊文件名下載附件
1.12 KB, 下載次數(shù): 14
|