Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME

in this case i want to make a dust monitoring projet with Blynk connection. But when i integrated my program code with blynk template code, i meet some error : #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"

In this case im very confused, I had declared BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME at the beginning of the program like the following snippet of my program code:

#include <Blynk.h>
#include <BlynkSimpleEsp32.h>
#include <WiFi.h>

#define BLYNK_TEMPLATE_ID "xxxxxxx"
#define BLYNK_TEMPLATE_NAME "xxxxxxx"
#define BLYNK_AUTH_TOKEN "xxxxxxxx"

But the error says, i must to defined the BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME. How supposed i do in this case? Thank you

In this case i already try to downgrade my Blynk library from 1.3.0 to 1.2.0, and the problem BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME error was solved. But with Blynk 1.2.0 libraries my ESP-32 cannot connect to Blynk Cloud.

If i upgrade my Blynk Library to 1.3.0 again, the problem comes again.

Upvotes: 1

Views: 13703

Answers (5)

arf
arf

Reputation: 1

Open this folder \Arduino\libraries\Blynk\src\Blynk then open the BlynkApi.h file then comment these lines

#if !defined(BLYNK_TEMPLATE_ID) || !defined(BLYNK_TEMPLATE_NAME)
 #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"
#endif

i hope this was helping

Upvotes: 0

ALI Mohammed
ALI Mohammed

Reputation: 1

Make sure to put the commands at very top of the paogram as follows:

#define BLYNK_TEMPLATE_ID "xxxxxxx"
#define BLYNK_TEMPLATE_NAME "xxxxxxx"

and before the commands of #include

#include <WiFi.h>
#include <Blynk.h>
#include <BlynkSimpleEsp32.h>

to be like this order

 #define BLYNK_TEMPLATE_ID "xxxxxxx"
 #define BLYNK_TEMPLATE_NAME "xxxxxxx"
 #include <WiFi.h>
 #include <Blynk.h>
 #include <BlynkSimpleEsp32.h>

and everything will be fine : ) : )

Upvotes: 0

Quintrex One
Quintrex One

Reputation: 11

Put the #include of the Blynk Library, AFTER #defines of your 3 Blynk variables, BLYNK_AUTH_TOKEN BLYNK_TEMPLATE_NAME and BLYNK_AUTH_TOKEN. e.g

#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID           "TMPL?????-u"
#define BLYNK_TEMPLATE_NAME         "ESP32DHT11"
#define BLYNK_AUTH_TOKEN            "LmnKOfjfkesoknjjjdtrash"

THEN!!    #include <BlynkSimpleEsp32.h>

good luck - Keith

Upvotes: 1

Gerd Lissewski
Gerd Lissewski

Reputation: 1

I have change in Code the name of "#define BLYNK_TEMPLATE_NAME "xxxxxxx"", in BLYNK Version 1.2 no problem. In version 1.3 you receive an error.

Upvotes: 0

Tom&#225;š Zato
Tom&#225;š Zato

Reputation: 53255

tldr: Put your #define BEFORE any Blynk headers

#include will essentially "copy-paste" the file you're including at the place you have the include. So if the Blynk library has this in one of the headers:

#ifndef BLYNK_TEMPLATE_ID
#error "Please specify id"
#endif

and you define the BLYNK_TEMPLATE_ID later, it will not compile, because at the compilation, the full code will look like this:

// from Blynk.h
#ifndef BLYNK_TEMPLATE_ID
#error "Please specify id"
#endif
// Blynk.h end
#define BLYNK_TEMPLATE_ID "xxxxxxx"
#define BLYNK_TEMPLATE_NAME "xxxxxxx"
#define BLYNK_AUTH_TOKEN "xxxxxxxx"

Since the check is before the #define, it will not compile. Also, since this is an auth token, you probably should not define it in code. Instead, you can pass parameter to the compiler to set #define that will apply for the entire compilation.

Upvotes: 2

Related Questions