#define BLYNK_TEMPLATE_ID "TMPL000000"
#define BLYNK_TEMPLATE_NAME "Gas Simulation"
#define BLYNK_AUTH_TOKEN "Ваш_Токен"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
const int gasPin = 34;
const int buzzerPin = 25;
const int ledPin = 26;
int threshold = 1000;
void setup() {
Serial.begin(115200);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
tone(buzzerPin, 1000);
delay(1000);
digitalWrite(ledPin, LOW);
noTone(buzzerPin);
Serial.println("Система готова к работе");
}
void loop() {
int gasValue = analogRead(gasPin);
Serial.print("Значение датчика: ");
Serial.print(gasValue);
if (gasValue > threshold) {
Serial.println(" -> СТАТУС: ТРЕВОГА!");
tone(buzzerPin, 1000);
digitalWrite(ledPin, HIGH);
} else {
Serial.println(" -> СТАТУС: НОРМА");
digitalWrite(ledPin, LOW);
noTone(buzzerPin);
}
delay(500);
}