使用 Blynk 将 ESP8266 连接到 Arduino Uno
Connecting an ESP8266 to an Arduino Uno using Blynk
我正在做一个项目,我试图通过 ESP8266 和 Arduino uno 使用 Blynk 应用程序通过 wifi 打开 LED。我相信电路设置正确,因为我能够 运行 一个空脚本并通过串行监视器发送“AT”命令并获得反馈。 ESP8266 也出现在我的 wifi 设置中。然而,从那里我试图在 blynk 应用程序上设置一个快速启动设备,这就是我被卡住的地方。
主要错误似乎是我无法下载必要的库,“ESP8266_Lib.h”,为了程序,Blynk 最初给你,运行。我试图在 github 上下载最新版本的 blynk 库,但仍然没有帮助。
在项目的这个阶段之后,我希望转移到 adrafruit gemma 板,并希望不会引起任何进一步的问题。 Blynk 提供的代码和错误消息如下:
'''
/*************************************************************
This is a simple demo of sending and receiving some data. Be
sure to check out other examples!
*************************************************************/
// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "TMPLAFgrm8rq"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "h51Uz7shHDeBiaiIXRvEQUYDsBZbwzBf"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials. // Set password to "" for open networks.
char ssid[] = "YourNetworkName"; char pass[] = "YourPassword";
BlynkTimer timer;
// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V0) { // Set incoming value from pin V0 to a variable
int value = param.asInt();
// Update state
Blynk.virtualWrite(V1, value); }
// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{ // Change Web Link Button message to "Congratulations!"
Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
Blynk.setProperty(V3, "onImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
Blynk.setProperty(V3, "url","https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}
// This function sends Arduino's uptime every second to Virtual Pin 2
void myTimerEvent() {
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V2, millis() / 1000); }
void setup() { // Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass); // You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent); }
void loop() {
Blynk.run();
timer.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
j:19:10: 致命错误: ESP8266_Lib.h: 没有那个文件或目录
19 | #include
| ^~~~~~~~~~~~~~~
编译终止。
退出状态 1
ESP8266_Lib.h: 没有那个文件或目录
BlynkESP8266_Lib 仅在 Release page 上的 Blynk 库的发布 zip 中可用。请参阅资产部分。
将文件夹 BlynkESP8266_Lib 从 zip 复制到速写本文件夹中的 libraries
文件夹中。 (草图文件夹的位置在 Arduino 的首选项对话框中设置 IDE。)
我正在做一个项目,我试图通过 ESP8266 和 Arduino uno 使用 Blynk 应用程序通过 wifi 打开 LED。我相信电路设置正确,因为我能够 运行 一个空脚本并通过串行监视器发送“AT”命令并获得反馈。 ESP8266 也出现在我的 wifi 设置中。然而,从那里我试图在 blynk 应用程序上设置一个快速启动设备,这就是我被卡住的地方。
主要错误似乎是我无法下载必要的库,“ESP8266_Lib.h”,为了程序,Blynk 最初给你,运行。我试图在 github 上下载最新版本的 blynk 库,但仍然没有帮助。
在项目的这个阶段之后,我希望转移到 adrafruit gemma 板,并希望不会引起任何进一步的问题。 Blynk 提供的代码和错误消息如下: '''
/*************************************************************
This is a simple demo of sending and receiving some data. Be
sure to check out other examples!
*************************************************************/
// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "TMPLAFgrm8rq"
#define BLYNK_DEVICE_NAME "Quickstart Device"
#define BLYNK_AUTH_TOKEN "h51Uz7shHDeBiaiIXRvEQUYDsBZbwzBf"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials. // Set password to "" for open networks.
char ssid[] = "YourNetworkName"; char pass[] = "YourPassword";
BlynkTimer timer;
// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V0) { // Set incoming value from pin V0 to a variable
int value = param.asInt();
// Update state
Blynk.virtualWrite(V1, value); }
// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{ // Change Web Link Button message to "Congratulations!"
Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
Blynk.setProperty(V3, "onImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
Blynk.setProperty(V3, "url","https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}
// This function sends Arduino's uptime every second to Virtual Pin 2
void myTimerEvent() {
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V2, millis() / 1000); }
void setup() { // Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass); // You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent); }
void loop() {
Blynk.run();
timer.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
j:19:10: 致命错误: ESP8266_Lib.h: 没有那个文件或目录
19 | #include
BlynkESP8266_Lib 仅在 Release page 上的 Blynk 库的发布 zip 中可用。请参阅资产部分。
将文件夹 BlynkESP8266_Lib 从 zip 复制到速写本文件夹中的 libraries
文件夹中。 (草图文件夹的位置在 Arduino 的首选项对话框中设置 IDE。)