Example code to connect ESP8266 or ESP32 boards to Blynk
ESP8266 board connect to Blynk
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "Your_AuthToken";
char ssid[] = "Your_Wifi_Name";
char pass[] = "Your_Wifi_Password";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}
ESP32 board connect to Blynk
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "Your_AuthToken";
char ssid[] = "Your_Wifi_Name";
char pass[] = "Your_Wifi_Password";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}