<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Vibration_Alarm</id>
		<title>Vibration Alarm - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Vibration_Alarm"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Vibration_Alarm&amp;action=history"/>
		<updated>2026-04-21T07:59:09Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Vibration_Alarm&amp;diff=10914&amp;oldid=prev</id>
		<title>1304410487@qq.com：Created page with &quot;{{Language| Vibration Alarm}} {| style=&quot;width: 800px;&quot; |- | ==Objective== To make a vibration alarm and when there is vibration, the buzzer will set off alarm audio twice.    ...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Vibration_Alarm&amp;diff=10914&amp;oldid=prev"/>
				<updated>2015-10-22T03:28:53Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Language| Vibration Alarm}} {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== To make a vibration alarm and when there is vibration, the buzzer will set off alarm audio twice.    ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Language| Vibration Alarm}}&lt;br /&gt;
{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Objective==&lt;br /&gt;
To make a vibration alarm and when there is vibration, the buzzer will set off alarm audio twice.  &lt;br /&gt;
&lt;br /&gt;
==Principle==&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Module||Number||Function &lt;br /&gt;
|-&lt;br /&gt;
|[[Microduino-CoreUSB]]||1||Core board &lt;br /&gt;
|-&lt;br /&gt;
|[[Microduino-Sensorhub]]||1||Sensor pin board&lt;br /&gt;
|-&lt;br /&gt;
| [[Microduino-BM]]||1||Battery management&lt;br /&gt;
|-&lt;br /&gt;
| [[Microduino-BUZZER]]||1||Buzzer sensor&lt;br /&gt;
|-&lt;br /&gt;
| [[Microduino-Shock]]||1||Vibration sensor &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
*Other Equipment: &lt;br /&gt;
**One battery &lt;br /&gt;
&lt;br /&gt;
 [[File: shock_alarm.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Hardware Buildup==&lt;br /&gt;
*Setup 1：Connect CoreUSB to the computer, open program examples, select the right board and serial port, then download the program. &lt;br /&gt;
[https://github.com/Microduino/Microduino_Tutorials/tree/master/MCookie_Tutorial/SHOCK_alarm SHOCK_alarm]&lt;br /&gt;
*Setup 2：Stack CoreUSB and Sensorhub together&lt;br /&gt;
 [[File: shock_alarm_setup_1.jpg|600px|center|thumb]]&lt;br /&gt;
*Setup3：Connect vibration sensor to the D4 pin of Sensorhub and buzzer sensor to D6. &lt;br /&gt;
[[file:Microduino-sensorhub_rule.JPG|thumb|800px|center]]&lt;br /&gt;
[[file: shock_alarm_setup_2.jpg |thumb|800px|center]]&lt;br /&gt;
*Setup4：Connect the battery to BM. &lt;br /&gt;
[[file: shock_alarm_bm.JPG|thumb|800px|center]]&lt;br /&gt;
&lt;br /&gt;
==Software Debugging==&lt;br /&gt;
*Function description: &lt;br /&gt;
**&amp;quot; buzzer()&amp;quot; : Buzzer alarm control function. &lt;br /&gt;
&lt;br /&gt;
*Control Pin Description &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define pushButton 4 //Vibration &lt;br /&gt;
#define speakPin 6 //Buzzer &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
*Judge if there is vibration in two seconds. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
  if (millis() - time &amp;gt; 2000)&lt;br /&gt;
  {&lt;br /&gt;
    if (!digitalRead(pushButton))&lt;br /&gt;
      shock = false;&lt;br /&gt;
    time = millis();&lt;br /&gt;
  }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*When detecting vibration, the buzzer will set alarm for twice repeatedly. Users can change alarm times. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
  if (shock)&lt;br /&gt;
  {&lt;br /&gt;
    for (int j = 0; j &amp;lt; 2; j++)&lt;br /&gt;
      buzzer();&lt;br /&gt;
  }&lt;br /&gt;
  else&lt;br /&gt;
    noTone(speakPin);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
When 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.&lt;br /&gt;
。&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>1304410487@qq.com</name></author>	</entry>

	</feed>