本帖最后由 roc2 于 2019-9-17 19:02 編輯
使用blynk app+服務器(本地) + 零知ESP8266硬件的方法,通過手機APP控制RGB led三色燈
1、硬件零知ESP8266開發板
RGB LED
2、軟件
具體的blynk軟件可到零知實驗室官網獲取
使用blynk新建工程,并選擇設備未NodeMCU,或ESP8266,然后增加ZERGBA控件,如下:
或者掃描二維碼查看完整工程
3、工程代碼- /* Comment this out to disable prints and save space */
- #define BLYNK_PRINT Serial
-
-
- #include <ESP8266WiFi.h>
- #include <BlynkSimpleEsp8266.h>
-
- // You should get Auth Token in the Blynk App.
- // Go to the Project Settings (nut icon).
- char auth[] = "xx";
-
- // Your WiFi credentials.
- // Set password to "" for open networks.
- char ssid[] = "xx";
- char pass[] = "xx";
-
- char local_domain[] = "192.168.0.111";
-
-
-
- void setup()
- {
- // Debug console
- Serial.begin(9600);
-
- Blynk.begin(auth, ssid, pass, local_domain,8080);
-
-
-
- }
-
- void loop()
- {
- Blynk.run();
-
- }
復制代碼 上面代碼中只需要填寫自己的TOKEN和wifi熱點名字、密碼即可。
4、 測試效果
表示我們與服務器通信成功
在手機blynk上面,點擊運行按鈕后,開始運行,然后就可以控制RGB顯示各種顏色了:
還有效果視頻哦!
更多詳細資料可到零知實驗室官網免費獲取。
|