Noise Alarm
From Microduino Wiki
Language: | English • 中文 |
---|
ContentsObjectiveWhen noise reaches a certain value around you, the alarm goes off.
PrincipleEquipment
Hardware Buildup
Software Debugging
Noise_alarm Code description
#define mic_pin A0
#define buzzer_pin 6
#define key_pin 4
#define voice 400
if (voice_data > voice)
{
if (millis() - time > 1000 )
{
voice_data = analogRead(mic_pin);
if (voice_data > voice)
{
buzzer_speak = true;
i = 200;
}
time = millis();
}
}
if (key_get(key_pin, 0))
{
delay(200);
buzzer_speak = false;
time = millis();
} ResultIf the sound around you exceeds the default value within one second, the alarm will go off. You can press the key and close the sound. (You can also build a beautiful cover with LEGO.) Video |