//wifi and blynk (i dont know what I am doing) stuff
#define BLYNK_TEMPLATE_ID "TMPL3J_WqqWQa"
#define BLYNK_TEMPLATE_NAME "petbuzzer"
#define BLYNK_auth_token "C_36dqDUxVUw8QqAq1DKHOCaz844MrTd"
#include <WiFiClient.h>
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "C_36dqDUxVUw8QqAq1DKHOCaz844MrTd";
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
//hardware stuff
#define LED 2
int buzzerPin = 12;
//setup
void setup() {
Serial.begin(115200);
//wifi connect
WiFi.begin(ssid, pass);
while (WiFi.status() !=WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...Please Wait");
}
Serial.println("Connected");
//connectin' to the blynk
Blynk.begin(auth, ssid, pass);
//hardware setup
pinMode(LED, OUTPUT);
pinMode(buzzerPin, OUTPUT);
}
//Blynk virtual pin handler
BLYNK_WRITE(V0){
int ledState = param.asInt();
if (ledState == 1) {
digitalWrite(LED, HIGH);
tone(buzzerPin, 262, 250);
delay(500);
digitalWrite(LED, LOW);
tone(buzzerPin, 300, 1000);
delay(2000);
digitalWrite(LED, HIGH);
tone(buzzerPin, 262, 250);
delay(500);
digitalWrite(LED, LOW);
tone(buzzerPin, 300, 1000);
delay(2000);
digitalWrite(LED, HIGH);
tone(buzzerPin, 262, 250);
delay(500);
digitalWrite(LED, LOW);
tone(buzzerPin, 300, 1000);
delay(2000);
digitalWrite(LED, HIGH);
tone(buzzerPin, 262, 250);
delay(500);
digitalWrite(LED, LOW);
tone(buzzerPin, 200, 1000);
delay(2000);
digitalWrite(LED, LOW);
} else {
digitalWrite(LED, LOW);
}
}
void loop(){
Blynk.run();
}