Connections Arduino:
// digital signal =[Pin 3]
+V =[Pin 5V]
GND =[Pin GND]
analog signal =[Pin 0]
ARDUINO KÓD - analóg
/*
modified on June 5, 2018
by Arduino Examples from arduino.cc/en/Tutorial/ReadAnalogVoltage
Home
*/
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
}
ARDUINO KÓD -digitális
/*
modified on Spe 2, 2020
by MohammedDamirchi
Home
*/
const int mic = 8;
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// initialize the digital pin as an input:
pinMode(mic, INPUT);
}
void loop() {
// check if the mic digitalout is high.
if (digitalRead(mic) == HIGH) {
Serial.println("hearing something");
}
}
forrás:
https://electropeak.com/learn/interfacing-ky-037-sound-sensor-with-arduino/?srsltid=AfmBOopCSYTjXWkHrp5BxuTX_sOiH2Kr7Out_j1yx19lopKO3InRPn8D