Vibration Alarm
1304410487@qq.com(讨论 | 贡献)2015年10月22日 (四) 03:28的版本 (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 |
---|
ObjectiveTo 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 |