Skip to content

Commit ce85b71

Browse files
authored
Changing amplitude example to output values in dB (#24)
1 parent e59260f commit ce85b71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/AmplitudeSerialPlotter/AmplitudeSerialPlotter.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ void loop() {
4949
if (amplitudeAnalyzer.available()) {
5050
// read the new amplitude
5151
int amplitude = amplitudeAnalyzer.read();
52-
53-
// print out the amplititude to the serial monitor
54-
Serial.println(amplitude);
52+
//dB relative to full scale
53+
int dpFS = 20 * log10(abs(amplitude));
54+
// print out the decibel to the serial monitor
55+
Serial.println(dpFS);
5556
}
5657
}

0 commit comments

Comments
 (0)