#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL610hA00HI"
#define BLYNK_TEMPLATE_NAME "LAMPU01"
#define BLYNK_AUTH_TOKEN "SSvXzNwz0F1olfsLQqU2CTV3qaLhyPZg"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
BlynkTimer timer;
char auth[] = "SSvXzNwz0F1olfsLQqU2CTV3qaLhyPZg";
char ssid[] = "Wokwi-GUEST"; // Ganti dengan SSID WiFi Anda
char pass[] = ""; // Ganti dengan Password WiFi Anda
const int LED = 4;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(LED, OUTPUT);
// Inisialisasi Blynk
Blynk.begin(auth, ssid, pass);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
timer.run();
}
BLYNK_WRITE(V2)
{
int pinValue = param.asInt(); // Baca nilai dari aplikasi Blynk
digitalWrite(LED, pinValue); // Atur LED sesuai nilai
}