arduino-esp8266開發(fā)環(huán)境配置記錄
網(wǎng)上購買了esp8266的迷你開發(fā)板,自帶串口燒錄(CH340G芯片),先上圖:



串口芯片驅(qū)動安裝:
連上usb,自動聯(lián)機查找驅(qū)動就安裝好了。


arduino-esp8266.readthedocs(英文開發(fā)手冊):
https://arduino-esp8266.readthedocs.io/en/2.7.2/
中文官方文檔:
https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_cn.pdf
?
?用Arduino工具開發(fā):
從 Arduino 官網(wǎng) 下載最新版本Arduino IDE 軟件并安裝(我的環(huán)境版本:Arduino 1.8.12)。
安裝完成后,選擇文件/首選項,找到附加開發(fā)板管理器地址,并添加如下信息:
http://arduino.esp8266.com/stable/package_esp8266com_index.json


查找esp關(guān)鍵字,點擊esp8266安裝:

十分鐘過去了,好慢~~~~我有耐心。

………………….
…………………….
………………………….
這個程序還要下載國外的文件,實在太慢,經(jīng)常的卡死,沒辦法,有條件的還是用VPN翻一下吧。
我這里只有網(wǎng)頁代理,我的惡夢就這樣開始了,經(jīng)過兩天的摸索,
找到了Arduino安裝下載文件的緩沖區(qū),就是要找到"C:\Users\(注意:Administrator這里對應(yīng)你的用戶名)Administrator\AppData\Local\Arduino15" 。
打開這個package_esp8266com_index.json文件找下載地址:
,

用網(wǎng)頁下載方式下載下來,放到下圖路徑中去:

這是總共要下載的5文件,下什么文件因系統(tǒng)環(huán)境而異。(其實我是一邊打開這個文件夾,一邊用面板安裝看下載到這個文件夾的是什么文件名,然后在package_esp8266com_index.json搜索出確切路徑,復(fù)制地址到瀏覽器地址上下載)
下載完成后,到開發(fā)版管理器點擊安裝,完成,重啟arduino,如下圖,既可以看見esp8566的選項

Arduino新建一個test工程

寫入測試串口回復(fù)的代碼:
char incomedate;
void setup() {
? // put your setup code here, to run once:
Serial.begin(115200);
Serial.print("sys is running!\n");
Serial.print("中文測試\n");
}
void loop() {
? // put your main code here, to run repeatedly:
? if (Serial.available() > 0)//串口接收到數(shù)據(jù)
? {
??? incomedate = Serial.read();//獲取串口接收到的數(shù)據(jù)
??? Serial.print(incomedate);
? }
}
編譯下載運行:

打開串口測試成功:

Wifi連接測試:
#include <ESP8266WiFi.h>
const char* ssid = "xxxxx";#輸入你要連接的SSID
const char* password = "********";#輸入密碼
void setup(void)
{
? // 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
? Serial.println(WiFi.localIP());
}??
void loop() {}

回顯分配到的IP,測試成功。