Skip to menu

Robotics with Object Pascal

ESP32-S3 super mini experience

Sound Sensor Test

2025.04.27 21:48

me Views:41

char s[50];  // for formatted output using sprintf

void setup() {
  // initialize serial communication at 115200 bits per second:
  Serial.begin(115200);

  //set the resolution to 12 bits (0-4095)
  analogReadResolution(12);
}

void loop() {
  // read the analog / millivolts value for pin 6:
  int analogValue = analogRead(6);
  int analogVolts = analogReadMilliVolts(2);

  sprintf(s, "%4d, %4d", analogValue-1800, analogVolts);
  Serial.println(s);
 
  delay(50);  // delay in between reads for clear read from serial
}

 

SoundSensorDemo.png