硬件準(zhǔn)備
首先需要準(zhǔn)備一個(gè)開發(fā)板,這里我準(zhǔn)備的是淘寶購(gòu)買的兼容arduino的ESP8266模塊。
arduino配置
我使用的是arduino來編程實(shí)現(xiàn),故需要下載對(duì)應(yīng)的庫(kù)文件,打開arduino ide,文件->首選項(xiàng),在下圖紅框內(nèi)輸入:http://arduino.esp8266.com/stable/package_esp8266com_index.json
點(diǎn)擊確定之后在打開開發(fā)板管理器。
之后輸入esp8266,安裝對(duì)應(yīng)的庫(kù)文件,因?yàn)槲乙呀?jīng)安裝,故顯示為灰色,由于網(wǎng)絡(luò)原因,下載的時(shí)間可能比較久。
安裝完畢之后,選擇Generic ESP8266 Module進(jìn)行開發(fā)。
至此,ESP8266已經(jīng)配置完畢。
代碼
本文使用點(diǎn)亮LED來驗(yàn)證模塊是否配置正確,點(diǎn)燈的代碼如下所示。
上圖可以得知LED在GPIO2上。
#include
#define led 2 //發(fā)光二極管連接在8266的GPIO2上
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);//設(shè)置led管腳為輸出模式
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(led, LOW);//點(diǎn)亮LED
delay(500);//延時(shí)500ms
digitalWrite(led, HIGH);//點(diǎn)亮LED//點(diǎn)亮LED
delay(500);//延時(shí)500ms//延時(shí)500ms
}
結(jié)果演示
審核編輯:湯梓紅
-
開發(fā)板
+關(guān)注
關(guān)注
25文章
5121瀏覽量
98195 -
Arduino
+關(guān)注
關(guān)注
188文章
6477瀏覽量
187819 -
ESP8266
+關(guān)注
關(guān)注
50文章
962瀏覽量
45330
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
ESP8266開發(fā)教程-Arduino IDE安裝、配置與使用以及Arduino編程
![<b class='flag-5'>ESP8266</b>開發(fā)教程-<b class='flag-5'>Arduino</b> IDE安裝、<b class='flag-5'>配置</b>與使用以及<b class='flag-5'>Arduino</b>編程](https://file.elecfans.com//web2/M00/47/71/poYBAGKbeTuAekhXAACD9KdwM28739.png)
arduino(1)--ESP8266配置
如何使用Arduino ESP8266開發(fā)板配置標(biāo)準(zhǔn)的Arduino開發(fā)環(huán)境
![如何使用<b class='flag-5'>Arduino</b> <b class='flag-5'>ESP8266</b>開發(fā)板<b class='flag-5'>配置</b>標(biāo)準(zhǔn)的<b class='flag-5'>Arduino</b>開發(fā)環(huán)境](https://file.elecfans.com/web1/M00/83/71/pIYBAFxIB6SAG7BZAADyLDQ4sB4455.png)
Arduino、ESP8266與NodeMCU
![<b class='flag-5'>Arduino</b>、<b class='flag-5'>ESP8266</b>與NodeMCU](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
ESP8266 nodemcu使用arduino編程點(diǎn)亮OLED測(cè)試
![<b class='flag-5'>ESP8266</b> nodemcu使用<b class='flag-5'>arduino</b>編程點(diǎn)亮OLED測(cè)試](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
Arduino-ESP8266 NodeMCU的UDP通信
![<b class='flag-5'>Arduino-ESP8266</b> NodeMCU的UDP通信](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
esp筆記(2)使用Arduino IDE 開發(fā) esp8266
![<b class='flag-5'>esp</b>筆記(2)使用<b class='flag-5'>Arduino</b> IDE 開發(fā) <b class='flag-5'>esp8266</b>](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
esp8266 nodeMCU arduino開發(fā)環(huán)境
![<b class='flag-5'>esp8266</b> nodeMCU <b class='flag-5'>arduino</b>開發(fā)環(huán)境](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
配置esp8266開發(fā)板的Arduino開發(fā)環(huán)境
![<b class='flag-5'>配置</b><b class='flag-5'>esp8266</b>開發(fā)板的<b class='flag-5'>Arduino</b>開發(fā)環(huán)境](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
解決 用arduino ide 開發(fā)nodemcu 加載ESP8266庫(kù)的問題
![解決 用<b class='flag-5'>arduino</b> ide 開發(fā)nodemcu 加載<b class='flag-5'>ESP8266</b>庫(kù)的問題](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
如何使用ESP8266制作可配置的Web服務(wù)器
![如何使用<b class='flag-5'>ESP8266</b>制作可<b class='flag-5'>配置</b>的Web服務(wù)器](https://file.elecfans.com/web2/M00/42/B4/pYYBAGJ6EhOAY0C7AAK3HPlkWv0906.png)
使用Arduino編程ESP8266 ESP 01
![使用<b class='flag-5'>Arduino</b>編程<b class='flag-5'>ESP8266</b> <b class='flag-5'>ESP</b> 01](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
評(píng)論