#define BLYNK_TEMPLATE_ID "TMPL6NC2o68cu"
#define BLYNK_TEMPLATE_NAME "CONTROL LED 2"
#define BLYNK_AUTH_TOKEN "5zZUOWX5mSL5IMVoQ5o8pQkvAittZJkI"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST"; //nama hotspot yang digunakan
char pass[] = ""; //password hotspot yang digunakan
BlynkTimer timer;
void setup()
{
Serial.begin(115200);
pinMode(5, OUTPUT); // Set pin 5 as output for LED control
pinMode(26, OUTPUT); // Set pin 26 as output for LED control
Blynk.begin(auth, ssid, pass);
}
BLYNK_WRITE(V0)
{
int pinValue = param.asInt(); // Assign incoming value from pin V0 to a variable
if (pinValue == 1)
{
digitalWrite(5, HIGH); // Turn on LED connected to pin 5
}
else
{
digitalWrite(5, LOW); // Turn off LED connected to pin 5
}
}
BLYNK_WRITE(V1)
{
int pinValue = param.asInt(); // Assign incoming value from pin V1 to a variable
if (pinValue == 1)
{
digitalWrite(26, HIGH); // Turn on LED connected to pin 26
}
else
{
digitalWrite(26, LOW); // Turn off LED connected to pin 26
}
}
void loop()
{
Blynk.run();
timer.run();
}