Blynk Authentication Error

Hello,

I am trying to incorporate Blynk into my project, and it is giving me a lot of grief that I can't undertstand. Here's my code:

// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>

// /* Fill in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "xxxxxxxxxx"
#define BLYNK_TEMPLATE_NAME "xxxxxx"
#define BLYNK_AUTH_TOKEN "xxxxxxx"

char blynkAuth[] = BLYNK_AUTH_TOKEN;


// Attach a Button widget (mode: Switch) to the Digital pin 7 - and control the built-in blue led.
// Attach a Graph widget to Analog pin 1
// Attach a Gauge widget to Analog pin 2

void setup()
{
    // Serial.begin(9600);
    delay(5000); // Allow board to settle

    Blynk.begin(blynkAuth);
}


void loop()
{
    Blynk.run();
}

And here is the error I get:

Processing  blynktest.ino
Checking library blynk...
Installing library blynk 1.3.2 to lib/blynk ...
Library blynk 1.3.2 installed.
make -C ../modules/photon/user-part all
make[1]: Entering directory `/firmware/modules/photon/user-part'
make -C ../../../user 
make[2]: Entering directory `/firmware/user'
Building cpp file: src/blynktest.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-6-msrc/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFORM_NAME=photon -DPLATFORM_GEN=2 -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb --specs=nano.specs -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=6 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=2.3.1 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../third_party/nanopb/nanopb -I../communication/inc -I../hal/inc -I../hal/shared -I../hal/src/photon -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/network/util -I../hal/network -I../hal/src/photon/api -I../hal/src/photon/include -I../hal/src/photon/wiced/security/BESL/host/WICED/ -I../hal/src/photon/wiced/security/BESL/include -I../hal/src/photon/wiced/security/BESL -I../hal/src/photon/wiced/security/BESL/crypto -I../hal/src/photon/wiced/WWD/include/ -I../hal/src/photon/wiced/platform/include/ -I../hal/src/photon/wiced/platform/GCC/ -I../hal/src/photon/wiced/security/BESL/supplicant/ -I../hal/src/photon/libraries/crypto -I../hal/src/photon/libraries/daemons/DNS_redirect -I../third_party/miniz/miniz -I../platform/shared/inc -I../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../dynalib/inc -Isrc -I./libraries -Ilib/blynk/src -I. -MD -MP -MF ../build/target/user/platform-6-msrc/blynktest.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Werror=return-type -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DBOOTLOADER_SDK_3_3_0_PARTICLE -DPARTICLE_DCT_COMPATIBILITY -DSPARK_PLATFORM_NET=BCM9WCDUSI09 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x80A0000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,2302 -DMODULE_DEPENDENCY2=0,0,0 -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -flto -ffat-lto-objects -DPARTICLE_COMPILE_LTO_FAT -fno-use-cxa-atexit -std=gnu++14 -c -o ../build/target/user/platform-6-msrc/blynktest.o src/blynktest.cpp
In file included from lib/blynk/src/BlynkApiParticle.h:14,
                 from lib/blynk/src/Adapters/BlynkParticle.h:14,
                 from lib/blynk/src/BlynkSimpleParticle.h:14,
                 from lib/blynk/src/blynk.h:11,
                 from blynktest.ino:2:
lib/blynk/src/Blynk/BlynkApi.h:39:6: error: #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"
   39 |     #error "Please specify your BLYNK_TEMPLATE_ID and BLYNK_TEMPLATE_NAME"
      |      ^~~~~
make[2]: *** [../build/target/user/platform-6-msrc/blynktest.o] Error 1
make[2]: Leaving directory `/firmware/user'
make[1]: *** [user] Error 2
make[1]: Leaving directory `/firmware/modules/photon/user-part'
make: *** [modules/photon/user-part] Error 2

I have used Blynk in other projects before, and have not had any trouble at all. Is this because of the new Blynk, or am I doing something wrong here?
Nate

Have you tried defining the values before the include statement?

Since the error message is produced by a statement in the header (i.e. lib/blynk/src/Blynk/BlynkApi.h:39:6: error: #error "Please specify ...) it's rather obvious that any #defines after that check could not undo that error retroactively :wink:

BTW, the examples provided with the library also hold it that way.

1 Like

This is because of the new Blynk.

ScruffR is right. Another angle:

1 Like

Fair enough! I don't know if I've ever used a library before that required initializing before importing, but this worked. Thanks a bunch!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.