#define BLYNK_TEMPLATE_ID "TMPLfjkMeE55"
#define BLYNK_DEVICE_NAME "Latihan ESP32"
#define BLYNK_AUTH_TOKEN "jppYIUxCwpUa3RO_8Xv6HhKt41-X9PnS"
// 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; // program menghidupkan & mematikan led via WEB (BLYNK)
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define led 13
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V0)
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
if (pinValue == 1 ){
digitalWrite(led, HIGH);
}
else if (pinValue == 0){
digitalWrite(led, LOW);
}
// process received value
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(led, OUTPUT);
Blynk.begin(auth, ssid, pass);
// 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();
}