I'm a beginner and I'm working on a project to light an LED using DOIT ESP32 devkit v1. I want to turn on and off the LED using a phone app via wifi (using Blynk application). I'm using the following code on Arduino IDE (version 1.8.13):
#define BLYNK_PRINT Serial
#define LED 2
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "...";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "...";
char pass[] = "...";
void setup() {
pinMode(LED, OUTPUT);
pinMode(LED, HIGH);
Serial.begin(115200);
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
int wifi_ctr = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected");
Blynk.begin("Your auth token key", ssid, pass);
}
void loop(){
Blynk.run();
}
The connection to the wifi succeeded, But when I press the serial monitor button I get an error saying "Invalid auth token"
I don't understand what am I doing wrong, I've check the auth key few times, that's the right one. In the Blynk project I've chose ESP32 Dev Kit and in the Arduino IDE I chose DOIT ESP32 Dev Kit V1 along with port COM4 (I've made sure that's the right one). I think the problem is that I'm not using Blynk right, What do I need to do?
Thank you.
char auth[] = "...";
andBlynk.begin("Your auth token key", ssid, pass);
\$\endgroup\$