/**use bkynk switch to turn on the LED**/
//blynk code
#define BLYNK_TEMPLATE_ID "TMPL6O3hRGNJz"
#define BLYNK_TEMPLATE_NAME "New project"
#define BLYNK_AUTH_TOKEN "uKL09CWbxnTNTv7d6iCVKHcEQ-O_7zuY"
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BLYNK_WRITE(V0)
{
int pinValue = param.asInt();
if( pinValue == 1)
{
digitalWrite(2, HIGH);
}
else{
digitalWrite(2, LOW);
}
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(2, OUTPUT);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}