Microphone
you can see the angualr displacement of the wave on Serial Monitor
hardware
- Arduino Board
- Sound Board
wire
- A0 AO
- VCC +
- GND G
code
const int ledPin = 13; // pin13 built-in LED
const int soundPin = A0; // sound sensor attach to A0
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
Serial.begin(9600); // initialize the serial communication as 9600bps
}
void loop() {
// put your main code here, to run repeatedly:
int value = analogRead(soundPin); // read the value of sound sensor
Serial.println(value);
if (value > 600) {
digitalWrite(ledPin, HIGH); // turn on the LED
delay(200);
} else {
digitalWrite(ledPin, LOW); // turn off the LED
}
}