- /* 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热点名字、密码即可。
四、测试验证
(1)在零知开发工具中,可以在串口调试窗口看到如下信息:
表示我们与服务器通信成功的。
(2)在手机blynk上,点击运行按钮后,开始运行,然后就可以控制RGB显示各种颜色了: