Difference between revisions of "Sound Detection Sensor"
From Microduino Wiki
(→Experiment: To Detect Sound Intensity) |
|||
Line 69: | Line 69: | ||
} | } | ||
</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:upload.JPG|500px|center]] | [[file:upload.JPG|500px|center]] | ||
− | *After | + | *Upload the program directly. |
+ | [[file:uploadsound.JPG|500px|center]] | ||
+ | *After the upload, you can open the serial monitor. The displayed value reflects the current sound intensity. | ||
[[file:mCookie-Sound-res.JPG|500px|center]] | [[file:mCookie-Sound-res.JPG|500px|center]] | ||
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 |