/*************************************************************
This sketch shows how to read values from Virtual Pins
App project setup:
Slider widget (0...100) on Virtual Pin V1
*************************************************************/
// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "TMPLbXYoguX9"
#define BLYNK_DEVICE_NAME "IOT Assignments"
#define BLYNK_AUTH_TOKEN "oyKW5b--lfdHpQmNkG6S3BS09qA_b9up"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V4)
{
if(param.asInt()==1){
digitalWrite(25,HIGH);
}
else{
digitalWrite(25, LOW);
}
}
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(25, OUTPUT);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
}