Noise Alarm
1304410487@qq.com(讨论 | 贡献)2015年8月4日 (二) 03:30的版本 (Created page with "{{Language|Noise Alarm}} {| style="width: 800px;" |- | ==Objective== When noise reaches a certain value around you, the alarm goes off. ==Principle== ==Equipment== {|class...")
Language | English |
---|
ObjectiveWhen 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 |