#define BLYNK_TEMPLATE_ID "TMPL66txMeCFF"
#define BLYNK_TEMPLATE_NAME "KONTROL 3 LED"
#define BLYNK_AUTH_TOKEN "3czcOpZJaU2j2E0yoyacLIWYAvjdYcfR"

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>


char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "Wokwi-GUEST";
char pass[] = "";

const int redPin = 17;
const int yellowPin = 4;
const int greenPin = 2;

int pinValue = 0;

BLYNK_WRITE(V0){
  int pinValue = param.asInt();
  if(pinValue==1){
    digitalWrite(redPin,HIGH);
    Serial.println("Lampu Merah Menyala");
  }else{
    digitalWrite(redPin, LOW);
    Serial.println("Lampu Merah Padam");
  }
}

BLYNK_WRITE(V1){
  int pinValue = param.asInt();
  if(pinValue==1){
    digitalWrite(yellowPin,HIGH);
    Serial.println("Lampu Kuning Menyala");
  }else{
    digitalWrite(yellowPin, LOW);
    Serial.println("Lampu Kuning Padam");
  }
}

BLYNK_WRITE(V2){
  int pinValue = param.asInt();
  if(pinValue==1){
    digitalWrite(greenPin,HIGH);
    Serial.println("Lampu Hijau Menyala");
  }else{
    digitalWrite(greenPin, LOW);
    Serial.println("Lampu Hijau Padam");
  }
}
void setup() {
  Serial.begin(115200);
  pinMode(redPin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);

  Blynk.begin(auth, ssid ,pass);
}


void loop() {
  Blynk.run();
}