#define BLYNK_PRINT Serial
/* Fill in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "TMPL6JaX2odrw"
#define BLYNK_TEMPLATE_NAME "Wipi"
#define BLYNK_AUTH_TOKEN "w2COxp_qiSXsD8aZsldO74WXSJmnM5nD"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define pinLed 17
WiFiClient client;
void setup() {
// Debug console
Serial.begin(9600);
pinMode(pinLed, OUTPUT);
digitalWrite(pinLed, LOW);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
}
BLYNK_WRITE(V0) {
int ledState = param.asInt(); // Membaca nilai dari aplikasi (0 atau 1)
digitalWrite(pinLed, ledState); // Mengontrol LED
}
void loop() {
Blynk.run();
}