최대 1 분 소요

일단 쉬워서 그냥 코드만 올립니다.

A0로 Analog 값을 받아서 그 값이 특정 이상 (400)이면 data 값을 보내는 겁니다.

Source code

#define SOUND_SENSOR A0
#define THRESHOLD_VALUE 400//The threshold to turn the led on 400.00*5/1024 = 1.95v
void setup() 
{
    pinMode(SOUND_SENSOR, INPUT); 
    Serial.begin(9600);
}
 
void loop() 
{
int sensorValue = analogRead(SOUND_SENSOR);//use A0 to read the electrical signal
        
if(sensorValue > THRESHOLD_VALUE)
{
                Serial.println(sensorValue);
delay(200);
}

}

\

\