Vibration Alarm
Language | English |
---|
目录[隐藏]ObjectiveTo make a vibration alarm and when there is vibration, the buzzer will set off alarm audio twice. PrincipleEquipment
文件:Shock alarm.jpg 600px Hardware Buildup
文件:Shock alarm bm.JPG 800px 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 |