/*
control led brightness
*/
#define POTENTIOMETER_PIN 35 //ESP32 pin connected to pontentiometer pin
#define BUZZER_PIN 21 //ESP32 pin connected to BUZZER pin
#define ANALOG_THRESHOLD 1000
void setup() {
pinMode(BUZZER_PIN, OUTPUT); //set ESP32 pin to output mode
}
void loop() {
int analogvalue = analogRead(POTENTIOMETER_PIN); //read the input on analog pin
if (analogvalue > ANALOG_THRESHOLD)
digitalWrite(BUZZER_PIN, HIGH); //turn on piezo Buzzer
else
digitalWrite(BUZZER_PIN, LOW); //turn off piezo BUzzer
}