Continuing the discussion from #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME" Blynk 2.0:
Appending this to this post since the topic is similar. When I attempt to compile my program on Sparkfun ESP32 Thing, I am getting the same error “Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME”. I am attaching code and also a copy of the compiler error message. I am using BLYNK library 1.3.2. The TEMPLATE ID and NAME define lines are at the start of the code (actual ID/name is omitted), and there is no confusion about DEVICE NAME and TEMPLATE NAME, as described by Pete. I loaded this code successfully previously, but now when I return to it to tweak it, it wont compile. Im wondering if there is a conflict from an updated version of a library or firmware or something. Thanks for help.
// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "xxxxxxxx"
#define BLYNK_DEVICE_NAME "xxxxxxxxx"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
#define APP_DEBUG //not sure this is needed
#include "BlynkEdgent.h"
#include "TimeLib.h"
BlynkTimer timer;
String Currentwkdaytext;
BLYNK_CONNECTED() { //when device is connected to server....
Blynk.sendInternal("rtc", "sync"); //request current local time for device. This runs once at the beginning when connected
}
BLYNK_WRITE(V0) //checks to see if V0 pin (Gate Control button on app) has changed
{
int pinValue = param.asInt(); //assigning incoming value from pin V0 to a variable
digitalWrite(5,pinValue); //sends High or Low value to digital pin 5 on ESP32 Thing. This is connected to gate control circuit
}
BLYNK_WRITE(InternalPinRTC) //check the value of InternalPinRTC where time is stored internally. Reports time when gate status was last checked - which is every second
{
long t = param.asLong(); //store the time in t variable if it has changed
time_t current = t; //this section uses Time Library to convert Unix time to normal time
int CurrentSecond = second(current);
int CurrentMinute = minute(current);
int CurrentHour = hour(current);
int CurrentDay = day(current);
int CurrentMonth = month(current);
int CurrentYear = year(current);
int CurrentWeekday = weekday(current);
String NewTime = ""; //this section formats each component of time so it can be displayed on app
if (CurrentWeekday == 1)
{ NewTime += String("Sun ");
}
if (CurrentWeekday == 2)
{ NewTime += String("Mon ");
}
if (CurrentWeekday == 3)
{ NewTime += String("Tue ");
}
if (CurrentWeekday == 4)
{ NewTime += String("Wed ");
}
if (CurrentWeekday == 5)
{ NewTime += String("Thu ");
}
if (CurrentWeekday == 6)
{ NewTime += String("Fri ");
}
if (CurrentWeekday == 7)
{ NewTime += String("Sat ");
}
NewTime += String(CurrentMonth) + "/";
NewTime += String(CurrentDay) + "/";
int yearshort = CurrentYear-2000; //shortens 2017 to just 17
NewTime += String(yearshort) + " ";
int newHour = CurrentHour; //next lines convert 24 hr clock to 12 hr clock
if (newHour > 12)
{
newHour = CurrentHour - 12;
NewTime += String(newHour) + ":";
if (CurrentMinute<10)
{
NewTime += String("0");
}
NewTime += String(CurrentMinute) + ":";
if (CurrentSecond<10)
{
NewTime += String("0");
}
NewTime += String(CurrentSecond);
NewTime += String(" PM");
}
else
{
NewTime += String(newHour) + ":";
if (CurrentMinute<10)
{
NewTime += String("0");
}
NewTime += String(CurrentMinute) + ":";
if (CurrentSecond<10)
{
NewTime += String("0");
}
NewTime += String(CurrentSecond);
NewTime += String(" AM");
}
Blynk.virtualWrite(V2, NewTime);
}
void myTimer() //This runs once a second and sends gate status to app, updates time from server to internal pin, which is reported out in code above
{
uint8_t redState = digitalRead(25);
uint8_t greenState = digitalRead(26);
// Read the door switch pin
// Pin 25 is pulled low internally. If the switch (and door) is open,
// pin 25 is LOW. If the switch is closed (door too), pin 25 is HIGH.
// LOW = open
// HIGH = closed
Blynk.sendInternal("rtc", "sync");
if (redState == HIGH && greenState == LOW) //if pin 25(Red LED) is on and pin 26(Green LED) is off
Blynk.virtualWrite(V1, "CLOSED"); // Update virtual variable, sent to app
if (redState == LOW && greenState == HIGH) //if pin25(Red LED) is off and pin 26(Green LED) is off
Blynk.virtualWrite(V1, "OPEN");
if (redState == LOW && greenState == LOW) //if both LED are off - (and presumably yellow is on/flashing)
Blynk.virutalWrite(V1, "Gate Moving...");
}
void setup()
{
pinMode(5,OUTPUT);
pinMode(25,INPUT); //for Red LED
pinMode(26, INPUT); //for Green LED
timer.setInterval(1000L, myTimer);
Serial.begin(115200);
BlynkEdgent.begin();
}
void loop() {
BlynkEdgent.run();
timer.run();
}
In file included from c:\Users\wmklm\Documents\WMK\Hobbies\Arduino\My Arduino Sketches\libraries\Blynk\src/BlynkApiArduino.h:14,
from c:\Users\wmklm\Documents\WMK\Hobbies\Arduino\My Arduino Sketches\libraries\Blynk\src/BlynkSimpleEsp32_SSL.h:21,
from C:\Users\wmklm\Documents\WMK\Hobbies\Arduino\My Arduino Sketches\Blynk 2.0 and ESP32 sketches NEW\ESP32_Gate_Status_Final_Code_Blynk_2.0_26Jan23\BlynkEdgent.h:8,
from C:\Users\wmklm\Documents\WMK\Hobbies\Arduino\My Arduino Sketches\Blynk 2.0 and ESP32 sketches NEW\ESP32_Gate_Status_Final_Code_Blynk_2.0_26Jan23\ESP32_Gate_Status_Final_Code_Blynk_2.0_26Jan23.ino:12:
c:\Users\wmklm\Documents\WMK\Hobbies\Arduino\My Arduino Sketches\libraries\Blynk\src/Blynk/BlynkApi.h:39:6: error: #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"
#error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"
^~~~~
exit status 1
Compilation error: exit status 1