Difference between revisions of "Sound Detection Sensor"
From Microduino Wiki
(→Experiment: To Detect Sound Intensity) |
(→Experiment: To Detect Sound Intensity) |
||
Line 70: | Line 70: | ||
</source> | </source> | ||
*Choose the right port from Tools→Serial Port in Arduino IDE after compiling. | *Choose the right port from Tools→Serial Port in Arduino IDE after compiling. | ||
− | [[file: | + | [[file:uploadsound1.JPG|600px|center]] |
*Upload the program directly. | *Upload the program directly. | ||
− | [[file:uploadsound.JPG| | + | [[file:uploadsound.JPG|600px|center]] |
*After the upload, you can open the serial monitor. The displayed value reflects the current sound intensity. | *After the upload, you can open the serial monitor. The displayed value reflects the current sound intensity. | ||
− | [[file:mCookie-Sound-res.JPG| | + | [[file:mCookie-Sound-res-sensor.JPG|600px|center]] |
===Program Debugging === | ===Program Debugging === |
Revision as of 02:08, 5 November 2015
ContentsOutlineSound detection sensor can detect sound intensity but cannot recognize the specified sound.
Specification
DevelopmentEquipment
Preparation
Experiment: To Detect Sound Intensity
#define mic_pin A0
int sensorValue;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(mic_pin, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
sensorValue = analogRead(mic_pin);
// print out the value you read:
Serial.print("Sound:");
Serial.println(sensorValue);
delay(100); // delay in between reads for stability
}
Program Debugging
Video |