Vibration Alarm
From Microduino Wiki
Revision as of 03:28, 22 October 2015 by 1304410487@qq.com (talk) (Created page with "{{Language| Vibration Alarm}} {| style="width: 800px;" |- | ==Objective== To make a vibration alarm and when there is vibration, the buzzer will set off alarm audio twice. ...")
Language: | English • 中文 |
---|
ContentsObjectiveTo make a vibration alarm and when there is vibration, the buzzer will set off alarm audio twice. PrincipleEquipment
Hardware Buildup
Software Debugging
#define pushButton 4 //Vibration
#define speakPin 6 //Buzzer
if (millis() - time > 2000)
{
if (!digitalRead(pushButton))
shock = false;
time = millis();
}
if (shock)
{
for (int j = 0; j < 2; j++)
buzzer();
}
else
noTone(speakPin); ResultWhen knocking on the vibration sensor, the buzzer will make alarm twice and will stop when there is no vibration after the alarm. You can also build a beautiful shell with LEGO for the project since mCookie can be easily stacked with LEGO boards. 。 Video |