// Does the buzzer work with the tone() function on a ESP32 ?
// Answer: Yes
const int buzzerPin = 16;
void setup()
{
Serial.begin(115200);
Serial.println("Testing the tone() function on a ESP32");
delay(400);
}
void loop()
{
int frequency = random(500,1100);
tone(buzzerPin,frequency);
delay(80);
noTone(buzzerPin);
delay(300);
}