Arduino与NodeMCU——联网
我們現在要使用Arduino IDE來配置您的ESP8266芯片。這是使用該芯片的好方法,因為您可以使用著名的Arduino IDE對其進行編程,并重復使用幾個現有的Arduino庫。
如果尚未完成,請安裝最新版本的Arduino IDE。您可以從http://www.arduino.cc/en/main/software獲取它。
現在,您需要執行以下步驟才能使用Arduino IDE配置ESP8266:
1.啟動Arduino IDE并打開“首選項”窗口。
2.在其他Board Manager URL中輸入以下URL:http://arduino.esp8266.com/stable/package_esp8266com_index.json
3.從Tools |中打開Boards Manager Board菜單并安裝esp8266平臺,如下所示:
將模塊連接到Wi-Fi網絡
現在,我們將檢查ESP8266和Arduino IDE是否正常工作,并將芯片連接到本地Wi-Fi網絡。
為此,讓我們執行以下步驟:
1.首先,我們需要編寫代碼然后將其上傳到電路板。 代碼很簡單; 我們只想連接到本地Wi-Fi網絡并打印電路板的IP地址。這是連接到網絡的代碼:
#include <ESP8266WiFi.h>
void setup() {
// put your setup code here, to run once:
const char* ssid = "203";
const char* password = "203forever";
// Start Serial
Serial.begin(115200);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Print the IP address
Serial.println(WiFi.localIP(http://www.my516.com));
}
void loop() {
// put your main code here, to run repeatedly:
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1
---------------------
轉載于:https://www.cnblogs.com/ly570/p/11102762.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的Arduino与NodeMCU——联网的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 表弟面试被虐,我教他缓存连招,借机蹭了波
- 下一篇: 卧槽!两大抓包神器的视频教程来啦!