#define BLYNK_TEMPLATE_ID "TMPL6rhdUxefj"
#define BLYNK_TEMPLATE_NAME "tugas imelda"
#define BLYNK_AUTH_TOKEN "us-C3E5NSD1TAAEZj4n6IOdxOGQ6VIt6"
#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
BLYNK_WRITE(V0)
{
int pinValue = param.asInt(); // assigning incoming value from pin V0 to a variable
if (pinValue == 1)
{
digitalWrite(4, HIGH);
}
else {
digitalWrite(4, LOW);
}
// process received value
}
BLYNK_WRITE(V1)
{
int pinValue = param.asInt(); // assigning incoming value from pin V0 to a variable
if (pinValue == 1)
{
digitalWrite(16, HIGH);
}
else {
digitalWrite(16, LOW);
}
// process received value
}
BLYNK_WRITE(V2)
{
int pinValue = param.asInt(); // assigning incoming value from pin V0 to a variable
if (pinValue == 1)
{
digitalWrite(17, HIGH);
}
else {
digitalWrite(17, LOW);
}
// process received value
}
BLYNK_WRITE(V3)
{
int pinValue = param.asInt(); // assigning incoming value from pin V0 to a variable
if (pinValue == 1)
{
digitalWrite(5, HIGH);
}
else {
digitalWrite(5, LOW);
}
// process received value
}
BLYNK_WRITE(V4)
{
int pinValue = param.asInt(); // assigning incoming value from pin V0 to a variable
if (pinValue == 1)
{
digitalWrite(18, HIGH);
}
else {
digitalWrite(18, LOW);
}
// process received value
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(4, OUTPUT);
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
pinMode(5, OUTPUT);
pinMode(18, OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}