#define BLYNK_TEMPLATE_ID "TMPL6swRFAgo"
#define BLYNK_DEVICE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "OIvs2mMI-15OMvJ-NHZj--hlAQ_kJ2wW"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#define pinBuzzer 13
#include <ESP32Servo.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
BlynkTimer timer;
Servo myservo;
int rotasi = 90;
int nilainada;
int interval = 0;
BLYNK_WRITE(V6)
{
myservo.write(param.asInt());
}
BLYNK_WRITE(V7)
{
if (param.asInt() == 0) {
noTone(pinBuzzer);
} else {
tone(pinBuzzer, param.asInt());
}
}
BLYNK_CONNECTED()
{
Serial.println("Connected");
Blynk.syncVirtual(V6, V7);
}
void setup() {
Serial.begin(115200);
pinMode(pinBuzzer, OUTPUT);
myservo.attach(4);
myservo.write(90);
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
timer.run();
}