Arduino ide 编译器中出现 BLYNK_TEMPLATE_ID 和 BLYNK_TEMPLATE_NAME 错误

问题描述 投票:0回答:1

我已经提到了 BLYNK_TEMPLATE_ID 和 BLYNK_TEMPLATE_NAME,但我仍然收到此错误。 到目前为止我已经尝试了一切,但它不起作用。我已经给出了下面的代码,所以你们可以看一下我正在关注我的项目的 Youtube 视频,在视频中他没有收到任何错误,但是当我尝试相同的代码时,只是添加了有关我创建的 blynk 模板的信息我什至已经安装了所有需要的库。 我想将我的 BLYNK 应用程序与我的 IOT 项目链接起来,以便使用 blynk 平台从我的手机上控制它。过去两天我一直被这个错误困扰。 这是我遇到的错误#error“请指定您的 BLYNK_TEMPLATE_ID 和 BLYNK_TEMPLATE_NAME”

这是代码

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#define sensor 33
#define relay 4
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define BLYNK_TEMPLATE_ID "TMPL6emdmuXgp"
#define BLYNK_TEMPLATE_NAME "Plant watering System"
#define BLYNK_AUTH_TOKEN "***************************"
BlynkTimer timer;

char auth[] = "****************************";
char ssid[] = "Duaaa";
char pass[] = "*********";

void setup() {
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
  lcd.init();
  lcd.backlight();
  pinMode(relay, OUTPUT);
  digitalWrite(relay, HIGH);
.
.
.
.
}```
iot blynk
1个回答
0
投票

您的 Blynk 库版本可能需要这些代码行

#define BLYNK_TEMPLATE_ID "TMPL6emdmuXgp"
#define BLYNK_TEMPLATE_NAME "Plant watering System"
#define BLYNK_AUTH_TOKEN "***************************"

在草图的最顶部。

尝试将这些添加到代码的最顶部:)

Blynk 库的早期版本使用

BLYNK_DEVICE_NAME
而不是
BLYNK_TEMPLATE_NAME

如果您仍然卡住并使用旧格式,请尝试使用

BLYNK_DEVICE_NAME
而不是
BLYNK_TEMPLATE_NAME

© www.soinside.com 2019 - 2024. All rights reserved.