//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();
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
led1:A
led1:C
bz1:1
bz1:2