Static AuthToken

Static AuthToken is used when you are working with hardware that doesn't support Blynk.Edgent WiFi provisioning. For example when you are using Ethernet shield, or work with hardware that connects to the Internet over cellular (3G, LTE, etc) network.

Preparing your sketch

  1. Download the latest release of Blynk.Edgent as a Source code .zip file

  2. Open Arduino IDE

  3. In Arduino IDE menu go to Sketch - > Include Library

  4. Select Add .ZIP library

  1. Select the downloaded .zip archive. Press Choose to continue.

  2. After that, you should see Blynk folder under the File > Examples

  3. Select the example for the hardware you use. We will use the one for Arduino UNO + Ethernet shield

#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPLXtg6ltzI"
#define BLYNK_DEVICE_NAME "Test"
#include <BlynkSimpleEsp32.h>
char auth[] = "1jIajShg30JO-QQZmlWf1NjdH5FNi2wW";
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, "wifi-ssid", "wifi-pass");
}
void loop()
{
Blynk.run();
}

Pay attention to these 4 lines: you would need to fill them.

...
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
...
char auth[] = "YourAuthToken";
...
Blynk.begin(auth, "wifi-ssid", "wifi-pass");

Getting Template ID and Auth Token for device

Template ID and Device Name

  1. Log in to your Blynk.Console developer account

  2. If you don't have a Device Templates -> Create New Template or open an existing one

  3. Copy the contents of this section and paste them to your sketch

Template ID

Getting Auth Token

When the Template is ready, go to Search -> Devices - Create new device

  1. Choose a Template and give your new device a name

  1. After the device was created, open its dashboard, go to the Device Info tab. There you will find a field: Auth Token.

AuthToken

Now you have all the information you need to update your sketch:

#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPLbu8•••••"
#define BLYNK_DEVICE_NAME "My First Device 01"
#include <BlynkSimpleEsp32.h>
char auth[] = "••••••••••••••VoFvaUOH2U_sI";
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, "your_wifi-ssid", "your_wifi-pass");
}
void loop()
{
Blynk.run();
}
  1. Upload the sketch to your device

  2. Open Serial Monitor. Wait until you see something like this:

Blynk v.X.X.X
Your IP is 192.168.0.11
Connecting to...
Ready (ping: 40ms)