日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Arduino文档阅读笔记-WeMos D1 ESP8266 WIFI开发板入门

發布時間:2025/3/15 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Arduino文档阅读笔记-WeMos D1 ESP8266 WIFI开发板入门 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

WeMos D1開發板以ESP8266WIFI開發板為基礎,使用Arduino開發板的設計,工作電壓為3.3V設計出來的開發板,這個開發板僅僅是使用了Arduino uno的布局設計,并不是Arduino的開發板。

下面是關于這塊開發板的說明書:

總結下:

此開發板芯片為ESP8266(32位),緩存比Arduino Uno大,并且包含11個數字IO引腳以及1個模擬輸入引腳,使用Micro-B type USB線進行連接。

下面是引腳方面的說明!

所有的引腳都需要跑到3.3V上,并且除了D0口其他口都支持interrupt/PWM/I2C/one-wire。

下面是在Arduino IDE中部署其開發環境

軟件需要如下3個:

CH340G USB to UART driver:?https://www.wemos.cc/downloads

Python 2.7:?https://www.python.org/downloads/release/python-2713/

Arduino 1.8.2:?https://www.arduino.cc/en/Main/Software

?

在Arduino的目錄下新建2個文件夾esp8266com及esp8266

在Github上下載其庫文件:

將壓縮包放到esp8266目錄下,然后解壓:

將里面的文件移到到esp8266中,再將Arduino-master與Arduino-master.zip刪掉。

最后變成這個樣子即可!

打開CMD然后執行如下命名:

python get.py

此命令將會下載開發板所需要的工具,一切正常,且安裝好將會是這樣的。

這樣就完成了安裝!!!

?

使用Arduino IDE時要選中正確的開發板,Toos>Board中選擇"WeMos D1 R2 & Mini"即可:

下面是幾個示例代碼:

Blink

/*ESP8266 Blink by Simon PeterBlink the blue LED on the ESP-01 moduleThis example code is in the public domainThe blue LED on the ESP-01 module is connected to GPIO1 (which is also the TXD pin; so we cannot use Serial.print() at the same time)Note that this sketch uses LED_BUILTIN to find the pin with the internal LED */void setup() {pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output }// the loop function runs over and over again forever void loop() {digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level// but actually the LED is on; this is because // it is active low on the ESP-01)delay(1000); // Wait for a seconddigitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGHdelay(2000); // Wait for two seconds (to demonstrate the active low LED) }

查看下芯片的ID,這里串口打印頻率要選擇115200

/* Get Chip ID* wemos.cc* * */void setup() {Serial.begin(115200); }void loop() {Serial.println("");Serial.println("");Serial.println("Check ID in:");Serial.println("https://www.wemos.cc/verify_products");Serial.printf("Chip ID = %08Xn", ESP.getChipId());Serial.println("");Serial.println("");delay(5000); }

運行一個簡單的Web Server

#include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> #include <ESP8266mDNS.h>const char* ssid = "........"; const char* password = "........";ESP8266WebServer server(80);const int led = 13;void handleRoot() {digitalWrite(led, 1);server.send(200, "text/plain", "Hello from esp8266!");digitalWrite(led, 0); }void handleNotFound(){digitalWrite(led, 1);String message = "File Not Foundnn";message += "URI: ";message += server.uri();message += "nMethod: ";message += (server.method() == HTTP_GET)?"GET":"POST";message += "nArguments: ";message += server.args();message += "n";for (uint8_t i=0; i<server.args(); i++){message += " " + server.argName(i) + ": " + server.arg(i) + "n";}server.send(404, "text/plain", message);digitalWrite(led, 0); }void setup(void){pinMode(led, OUTPUT);digitalWrite(led, 0);Serial.begin(115200);WiFi.begin(ssid, password);Serial.println("");// Wait for connectionwhile (WiFi.status() != WL_CONNECTED) {delay(500);Serial.print(".");}Serial.println("");Serial.print("Connected to ");Serial.println(ssid);Serial.print("IP address: ");Serial.println(WiFi.localIP());if (MDNS.begin("esp8266")) {Serial.println("MDNS responder started");}server.on("/", handleRoot);server.on("/inline", [](){server.send(200, "text/plain", "this works as well");});server.onNotFound(handleNotFound);server.begin();Serial.println("HTTP server started"); }void loop(void){server.handleClient(); }

ssid填寫wifi名,password填寫wifi密碼

?

?

?

?

?

?

總結

以上是生活随笔為你收集整理的Arduino文档阅读笔记-WeMos D1 ESP8266 WIFI开发板入门的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。