#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL6aVFnqzua"
#define BLYNK_TEMPLATE_NAME "JUMAAT"
#define BLYNK_AUTH_TOKEN "2v0jgOZt4mbrRNZp06grbdGzlXPiFlPE"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
BlynkTimer timer;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define LED1 26
#define LED2 27
#define pinPB 32
#define pinAN 34
int status1=0, status2=1;
BLYNK_WRITE(V0)
{ int ledONE = param.asInt();
digitalWrite(LED1,ledONE);
}
BLYNK_WRITE(V1)
{ int ledTWO = param.asInt();
digitalWrite(LED2,ledTWO);
}
void kelip()
{
// digitalWrite(LED1,status1);
// digitalWrite(LED2,status2);
// status1 =! status1;
// status2 =! status2;
}
void getInput()
{ int pb = digitalRead(pinPB);
int an = analogRead(pinAN);
Serial.print(pb);
Serial.println(an);
Blynk.virtualWrite(V2,an/4096*100);
if(pb==0) Blynk.virtualWrite(V3,"Pushed");
if(pb==1) Blynk.virtualWrite(V3,"Idle");
}
void setup()
{ pinMode(LED1,OUTPUT);
pinMode(LED2,OUTPUT);
pinMode(pinPB,INPUT_PULLUP);
Serial.begin(9600);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
timer.setInterval(500L,kelip);
timer.setInterval(10L,getInput);
}
void loop()
{ Blynk.run();
timer.run();
}