//#include <Servo.h>
#include <ESP32Servo.h>
#define BLYNK_TEMPLATE_ID "TMPL6uSIs9jqB"
#define BLYNK_TEMPLATE_NAME "ESP32DHT22"
#define BLYNK_AUTH_TOKEN "eep_froCnmQwFHktnetKX8kG-zPxPPdH"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
int ldr, hujan;
Servo jemuran_1;
bool status = false;
BLYNK_WRITE(V3)
{
int pinValue = param.asInt();
if (pinValue ==1){
status = true;
}
else{
status = false;
}
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
jemuran_1.attach(25);
Blynk.begin(auth, ssid, pass);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
ldr = map(analogRead(34), 0, 4096, 100,0);
hujan = map(analogRead(35),0, 4096, 0,100);
if (status == true){
jemuran_1.write(0);
Serial.println("jemuran buka");
}
else{
if (ldr < 20 || hujan > 35){
jemuran_1.write(180);
Serial.println("jemuran tutup");
}
}
}//#include <Servo.h>
#include <ESP32Servo.h>
#define BLYNK_TEMPLATE_ID "TMPL6uSIs9jqB"
#define BLYNK_TEMPLATE_NAME "ESP32DHT22"
#define BLYNK_AUTH_TOKEN "eep_froCnmQwFHktnetKX8kG-zPxPPdH"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
int ldr, hujan;
Servo jemuran_1;
bool status = false;
BLYNK_WRITE(V3)
{
int pinValue = param.asInt();
if (pinValue ==1){
status = true;
}
else{
status = false;
}
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
jemuran_1.attach(25);
Blynk.begin(auth, ssid, pass);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
ldr = map(analogRead(34), 0, 4096, 100,0);
hujan = map(analogRead(35),0, 4096, 0,100);
if (status == true){
jemuran_1.write(0);
Serial.println("jemuran buka");
}
else{
if (ldr < 20 || hujan > 35){
jemuran_1.write(180);
Serial.println("jemuran tutup");
}
}
}