1 minute read
How to Make a Software VU Meter
232 Hacking Electronics
The “calibrate” function takes an initial reading of the acceleration on the X-axis, after waiting 200 milliseconds for the accelerometer to turn on properly.
void calibrate() { delay(200); // give accelerometer time to turn on levelX = analogRead(xPin); }
How to Make a Software VU Meter
Figure 9-22 Attaching a mic module to an Arduino
The mic module you used in the section “How to Make an FM Bug” is also perfectly suited for use with microcontrollers like the Arduino. Figure 9-22 shows the module with pins attached to it and pushed into the analog connector strip of the Arduino.
The mic module can be used to measure the sound level and write a number of “*”s to the Serial Monitor to indicate the loudness of the sound (Figure 9-23).
Figure 9-23 The Serial Monitor as a VU meter