我們現在要使用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
---------------------