04Blynk+ESP-01

(2017/01/31 大年初四)

今天直接用ESP-01(沒有接Arduino板),然後用Blynk來控制ESP-01上面接的LED燈或繼電器~~

題目一:利用Blynk APP來控制ESP-01上的LED燈

參考資料:臺南市教育局PM2.5監測網 - 線上書籍

一、ESP-01 在Arduino的安裝說明

二、Blynk 在Arduino下的函數庫

    • 燒錄程式時的接線說明:

1. download the latest blynk library from http://www.blynk.cc/getting-started/ , unzip and copy it to your arduino library directory (usually: C:\Program Files (x86)\Arduino\libraries).

2. Download blynk app for android or iphone ( it's in the apple / google play store for free) and make your first app. go to settings and chose esp8266.

3. under "settings" in the app you will find "auth token" email this to yourself, you will need it later (see image above)

4. open arduino IDE

5. under file, examples, choose blynk, "esp8266 standalone"

這部分與之前的WeMos的程式一樣

6. in the sketch, add the auth token from step 3 where it says auth token. SSID is geek language for the name of your wifi connection and password is the password to your wifi network. Fill these three in in the sketch in their respective places (see picture). There is no need to further edit the sketch. Just with this code you will have full control over all your board's pins through the app.Take my word for it, it will be great!

註:設定好Blynk專案名稱後,Blynk會將認證碼寄到MAIL信箱

三、開啟手機中的Blynk程式

  • 先認識ESP-01腳位

  • 我們使用GPIO0及GPIO2來接LED(三色LED)的正極

    • 建立一個新專案,設備要選擇ESP8266 (與WeMos一樣)

    • 新增一個Button元件及一個slider元件

題目二:利用Blynk APP來控制ESP-01上的繼電器

  • Blynk的程式同上

  • 只是將GPIO2接到繼電器上的IN腳

    • 離線使用

  • 由於繼電器也是接到3.3V的電,有時不是很穩!!