// ====== Микрофон на ESP32-S2 + График ======
const int MIC_PIN = 1; // ADC1_CH0 (рабочий в Wokwi для ESP32-S2)
const int SILENCE = 1800; // Средняя линия шумов
const int THRESHOLD = 200; // Порог звука
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("ESP32-S2 Microphone Demo — Open Serial Plotter!");
}
void loop() {
int sample = analogRead(MIC_PIN);
// Сдвигаем к линии тишины
int level = abs(sample - SILENCE);
// Выводим в Serial Plotter
Serial.println(level);
delay(10);
}