# field_data_body

entity_type: node
bundle: page
language: und
body_format: full_html
body_value:
  Weather Station
  Step 1: LCD Pinout and getting it going with the Arduino! 
  Step 2: Wiring up DHT11 Temp & Humidity sensor to the Arduino 
  Step 3: Booting up the Weather Station


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <p>
  	This article shows how to install the USB driver for the Arduino UNO in Windows 7 when it is plugged into the computer for the first time.</p>
  <p>
  	&nbsp;</p>
  <p>
  	What you found from the Window device manager is that there is an Arduino Uno device</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Uno_docs/Device_manager.jpg" style="width: 650px; height: 583px;" /></p>
  <p>
  	Double click the unknown Arduino Uno device, a property window pops up</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Uno_docs/Driver_update.jpg" /></p>
  <p>
  	&nbsp;</p>
  <p>
  	Choose the &#39;Driver&#39; tab, and select &#39;Update Driver...&#39;</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Uno_docs/Search_for_driver.jpg" style="height: 476px; width: 650px;" /></p>
  <p>
  	<br />
  	<img alt="" src="sites/default/files/pictures/Uno_docs/driver_dir.jpg" style="width: 336px; height: 328px;" /></p>
  <p>
  	Go to the Arduino IDE (also known as the Arduino Software) directory, and select the &#39;drivers&#39; direction, then click &#39;OK&#39;</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Uno_docs/installation_warning.jpg" style="width: 518px; height: 310px;" /></p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Uno_docs/Driver_installed.jpg" style="width: 630px; height: 483px;" /></p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Uno_docs/Device_manager_check.jpg" style="width: 650px; height: 474px;" /></p>
  <p>
  	Do a final check to make sure the driver has been correctly installed.</p>


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <div style="background-color: rgb(255, 255, 255);">
  	<p class="rteleft" dir="ltr" style="margin-top: 0pt; margin-bottom: 0pt;">
  		&nbsp;&nbsp;</p>
  </div>
  <div style="background-color: rgb(255, 255, 255);">
  	<div style="background-color: rgb(255, 255, 255);">
  		<p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  			<strong><span style="font-size: 16px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000">What is a Arduino Motorshield?</font></font></span></span></strong></p>
  		<p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  			<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">This Arduino Motor Shield is built upon the L298 Dual channel H-bridge IC, with a maximum DC current of 2 A for each channel. This current rating is sufficient for most home made medium size robots. It has 3 different power operating modes based on the positions of the jumpers. When plugged into an Arduino board, the Power Supply Mode Selection jumper allows you to choose how the motor shield and the Arduino are powered.</span></font></font></span></span></p>
  		<p>
  			&nbsp;</p>
  		<p>
  			<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><img src="/sites/default/files/Motorshield_1.jpg" style="cursor: default;" /></span></span></p>
  		<p>
  			&nbsp;</p>
  	</div>
  </div>
  <p>
  	&nbsp;</p>
  <p>
  	<strong><span style="font-size: 16px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000">Modes of operation:</font></font></span></span></strong></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	&nbsp;</p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<strong><span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000">Mode 1 : PWRIN &amp; VIN</font></font></span></span></strong></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000">This mode is to short both the PWRIN and VIN, which is the most commonly used configuration.</font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><img height="258px;" src="https://lh4.googleusercontent.com/c3_LAxag34O8AtlyDwnBRSpRud8mI0_ntoxoNNXX4vaMScReL7MDoQR40JfwiYDHJ061kRwWx9QwtiKHuOwwg-9_lJd7GxDTyXasX_CQs4G5k6g3zKU" style="cursor: default;" width="395px;" /></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">In this mode only one power source is needed to connect to the Motor Shield, which also supplies power to the Arduino underneath. The power source should be kept between 6.5 - 12 V.</span></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	&nbsp;</p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<strong><span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000">Mode 2: Vin only</font></font></span></span></strong></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000">In this mode, both of the jumpers are on VIN as shown in the figure below.</font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><img height="220px;" src="https://lh6.googleusercontent.com/Vu_5ynGCbsiHZrmzEvQhufUBori62V6gwJCyhLSDJL8Vzp8b2a3nuA-ZM7aQBNSQkSnyqjIY1OyJyzGDYaRHYYhwoEmbNJviRHI24zTM9lteGJ02Q1I" style="cursor: default;" width="411px;" /></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<br />
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">This mode actually lets the Motor Shield to get the power from the Arduino, which means the Arduino board has to be powered up by a center-positive power jack. Again, the voltage level should be 6.5 - 12 V.&nbsp;</span><br />
  	<br />
  	<strong>Mode 3: PWRIN only</strong></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: 14px;">In some applications you may wish to keep the power sources of the Motor Shield and the Arduino separate. This requires both jumpers to sit on the PWRIN as shown in the figure below.</span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><img height="227px;" src="https://lh5.googleusercontent.com/kFusgNCztIJFJTdrlQkUMvad9Xd1xhfFlw9ZbOoyffwTVbdEce2jK-Zfj2cAhzJh9jNMMzxx7vUEb-j6t3sFdvEpV81-NI8oiWfGew6SDSlrLfJWCjQ" style="cursor: default;" width="399px;" /></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<br />
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">A good reason to keep the power sources separate is when the Motor Shield needs to supply large current and there are substantial noise while controlling the current through PWM. If both the analog and the digital share the same power source, in the event of current surge, the voltage level can drop suddenly and hence the microcontroller can make wrong decisions. Better digital signal integrity is obtained if the analog and digital power supply are kept separate. But remember, they should have a common ground. In this mode, the voltage range &nbsp;to the Motor Shield &nbsp;is 4.8 - 24 V, and to the Arduino is 6.5-12V.</span></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<br />
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><img height="185px;" src="https://lh5.googleusercontent.com/Ud_fk-QNHuqt0JDsa3uwp7OKFzGIPFwXUAR69dO2cyqTBm40bOrsGXvzWrIpFUEy0rOiXoL0Sp9mowpPRbQWWgcV5IZ_tsA2y2l_x6wWtDAVbAUwIxA" style="cursor: default;" width="373px;" /></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">&nbsp;&nbsp;&nbsp;</span><br />
  	<span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">After selecting the power mode, the rest of the work is quite straightforward and pretty much self-explanatory. Connect the first motor to M1+ and M1- and the second motor to M2+ and M2-, the motor can be controlled through PWM (pulse width modulation) or PLL (Phase locked loop) by placing the jumpers in the Control Mode Selection.</span><br />
  	<br />
  	<strong><span style="font-size: 16px;"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Programming the Arduino</span></span></strong></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<br />
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Once all the wires are hooked up, you are ready to download the&nbsp;</span><a href="http://code.google.com/p/hobbyist-repository/source/browse/trunk/RoboTank/RoboTank.pde"><span style="color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: underline; vertical-align: baseline;">example code</span></a><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">&nbsp;to test the Motor Shield. The code should work on any Arduino compatible boards, and in particular we have tested it on Arduino Duemilanove 2009 and Arduino Mega 1280. Make sure you have your external power source connected, because the USB cable alone will be most likely not able to supply the current for the DC motors. From Arduino IDE, after plugging in the USB cable, double check if the correct board is selected from Tools -&gt; Boards, and the correct Serial port is selected from Tools -&gt; Serial port. &nbsp;Upload the program once you are happy with the settings. Open the serial monitor, press &lsquo;e&rsquo; and &lsquo;Enter&rsquo; on the keyboard, your motors should be turning and the serial monitor should display &ldquo;Go!!&rdquo;.</span></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><img height="297px;" src="https://lh3.googleusercontent.com/tpLA1Y98_zlj-uPuTwQ9XqCNc4uNwSgayLj4ntkOTl7MJM_C_A0cyGS71fyJWdEnXJ9IbRFhzduFU03J0JKHex1EJHYARMfZSq2HUDo7NZb_rqCjMcU" style="cursor: default;" width="337px;" /></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	&nbsp;</p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<strong><span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000">How to control the robot</font></font></span></span></strong></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<br />
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">If that&rsquo;s the case, congratulations, you have got the Motor Shield going! The &lsquo;s&rsquo;, &lsquo;f&rsquo;,&rsquo;c&rsquo; keys control the motors to turn in different directions, and the &lsquo;d&rsquo; key is to stop. Play with it, the direction of the motor may appear opposite to what you want. If this is the case, you may either need to swap the polarity of the motor or swap the High and Low logic in the code.&nbsp;</span><br />
  	<br />
  	<span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">If you still need some more references for the Motor Shield, you may download the&nbsp;<a href="http://sites.google.com/site/nzhobbyist/docs_cabinet/L298_Motor_Shield_Manual.pdf?attredirects=0">manual</a>.</span></font></font></span></span></p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	&nbsp;</p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	&nbsp;</p>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	<span style="font-size: 14px;"><span style="font-family: arial,helvetica,sans-serif;"><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#000000"><a href="?q=bluetooth-module-device">Step2: Test the Bluetooth module</a></font></font></span></span></p>
  <div class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	&nbsp;</div>
  <p class="rteleft" style="color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px;">
  	&nbsp;</p>
  <p>
  	&nbsp;</p>


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <p>
  	The Terminator is a low cost and easy to use robotic kit, it includes:</p>
  <ul>
  	<li>
  		<strong>Terminator chassis</strong></li>
  	<li>
  		<strong>Dual channel motor controller</strong></li>
  	<li>
  		<strong>Arduino Duemilanove</strong></li>
  	<li>
  		<strong>USB cable</strong></li>
  	<li>
  		<strong>AA x 4 battery case</strong></li>
  	<li>
  		<strong>some wires for connections</strong></li>
  </ul>
  <p>
  	No soldering is required!!</p>
  <p>
  	The Terminator shown in the photos here uses the Arduino Demilanove ( Can be replaced with Uno with no change in functionality or code )</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Terminator/Terminator_combo_small.jpg" style="width: 650px; height: 546px;" /></p>
  <p>
  	&nbsp;</p>
  <p>
  	The pin out of the motor controller is depicted in the photo below</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Terminator/pic2.jpg" style="width: 650px; height: 488px;" /></p>
  <p>
  	&nbsp;</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Terminator/pic3.JPG" style="width: 640px; height: 480px;" /></p>
  <p>
  	Blu-tack is used to fix the electronics on the chassis.</p>
  <p>
  	Ok, now it&#39;s time to wire the electronics up..First of all, connect the battery case to the Acc (red) and GND (black) of the controller. Then, use the provided wires, connect the controller to the Arduino according to the table below</p>
  <p>
  	&nbsp;</p>
  <table border="10" cellpadding="4" cellspacing="4" style="width: 638px;">
  	<thead>
  		<tr>
  			<th scope="col" style="width: 235px;">
  				Motor controller</th>
  			<th scope="col" style="width: 390px;">
  				Arduino</th>
  		</tr>
  	</thead>
  	<tbody>
  		<tr>
  			<td style="width: 235px;">
  				5 V</td>
  			<td style="width: 390px;">
  				5 V</td>
  		</tr>
  		<tr>
  			<td style="width: 235px;">
  				GND</td>
  			<td style="width: 390px;">
  				GND</td>
  		</tr>
  		<tr>
  			<td style="width: 235px;">
  				1</td>
  			<td style="width: 390px;">
  				Pin 5</td>
  		</tr>
  		<tr>
  			<td style="width: 235px;">
  				2</td>
  			<td style="width: 390px;">
  				Pin 6</td>
  		</tr>
  		<tr>
  			<td style="width: 235px;">
  				3</td>
  			<td style="width: 390px;">
  				Pin 9</td>
  		</tr>
  		<tr>
  			<td style="width: 235px;">
  				4</td>
  			<td style="width: 390px;">
  				Pin 10</td>
  		</tr>
  	</tbody>
  </table>
  <p>
  	Note: the reason why the Arduino pin 5,6,9,10 are chosen is because they all support PWM, which is needed for motor speed control using analogWrite() in the code.<br />
  	<img alt="" src="sites/default/files/pictures/Terminator/pic4.JPG" style="width: 640px; height: 480px;" /></p>
  <p>
  	Note that the GND of the controller needs to be shared with the Arduino and the battery case. Photo below shows the controller signals and power pins being connected to the Arduino.</p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Terminator/pic5.JPG" style="width: 640px; height: 480px;" /></p>
  <p>
  	For testing, no battery is needed, or the battery case can be left at the OFF position. Plug the Arduino to the PC via a USB cable, and down load this <a href="http://hobbyist-repository.googlecode.com/svn/trunk/Terminator/Terminator.pde">example code</a> to the Arduino. Switch on the serial monitor, and send the key &#39;e&#39;, and press enter, the Terminator should be turning..Play with the code and change anything you want. It is much easier to control the Terminator using the puTTY serial com interface instead of the Arduino Serial monitor, because in puTTY you don&#39;t need to press the enter key every&nbsp; time you send a command.</p>
  <p>
  	&nbsp;</p>
  <p>
  	<strong>How to make the Terminator go wireless ?</strong></p>
  <p>
  	<img alt="" src="sites/default/files/pictures/Terminator/Terminator_ortho_small.jpg" style="width: 640px; height: 480px;" /></p>
  <p>
  	To make the Terminator go wireless, all you need is a <a href="http://www.hobbyist.co.nz/?q=bluetooth-module-device">Bluetooth module</a>,</p>
  <p>
  	No&nbsp;modification is needed for the Arduino code. Since the Arduino only receives and sends data through its serial port, it doesn&#39;t even know and doesn&#39;t care whether the serial port&nbsp;is a Bluetooth or a cable connecting directly to the computer. Photo above shows a wireless Terminator. The LED on the Bluetooth stays on indicting the wireless connection has been established.</p>
  <p>
  	<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/an1lXpAVj-g" width="420"></iframe></p>
  <p>
  	The Terminator is ready for action!! &nbsp;There is a detailed tutorial on&nbsp;<a href="http://www.hobbyist.co.nz/?q=bluetooth-robot">how to connect the Bluetooth module to the Arduino</a>, See that for more details to interface the Bluetooth Module.</p>


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <p><span style="font-size: 16px;"><span style="font-family: arial,helvetica,sans-serif;">Objective here is to use the A/D converter on Arduino to read input sound and light up a set LEDs to reflect the level of the sounds volume. The LEDs are controlled from Digital pins 3, 4, 5,6. &nbsp;They are turned on based on what the level of input is from the Analog 0 pin, which is connected to the headphone jack.</span></span></p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><table class="c19" style="border-collapse: collapse; font-family: Arial;" cellspacing="0" cellpadding="0"><tbody><tr><td class="c12" style="vertical-align: top; width: 167.2pt; border: 1pt solid #000000; padding: 5pt;"><p class="c0 c13" style="margin: 0px; direction: ltr; line-height: 1;"><span class="c9 c11" style="font-size: 14pt;">Parts:</span></p></td></tr><tr><td class="c12" style="vertical-align: top; width: 167.2pt; border: 1pt solid #000000; padding: 5pt;"><p class="c0" style="margin: 0px; direction: ltr;"><span class="c14 c9" style="font-size: 12pt;">1x Arduino</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c14 c9" style="font-size: 12pt;">4x LEDs</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c14 c9" style="font-size: 12pt;">4x 390 ohm resistors</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c14 c9" style="font-size: 12pt;">1x 10k trimpot</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c9 c14" style="font-size: 12pt;">1x Headphone jack</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c9 c14" style="font-size: 12pt;">1x 10uF Capasitor</span></p></td></tr></tbody></table><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0 c4" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><a href="/sites/default/files/pictures/dancing-lights/dancinglights_step1.jpg"><img src="/sites/default/files/pictures/dancing-lights/dancinglights_step1.jpg" alt="Step one layout" title="Click to see full size image" width="600" height="360" /></a></p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><table class="c19" style="border-collapse: collapse; font-family: Arial; width: 653px;" cellspacing="0" cellpadding="0"><tbody><tr class="c10" style="height: 0pt;"><td class="c17" style="vertical-align: top; width: 637px; border: 1pt solid #000000; padding: 5pt;"><p class="c0" style="margin: 0px; direction: ltr;"><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// LED light dance</span></p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">#define</span><span class="c1" style="font-size: 10pt;">&nbsp;soundpin 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// &nbsp;reads the power from the light sensor from Analog input 0</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">#define</span><span class="c1" style="font-size: 10pt;">&nbsp;LED1 3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// &nbsp;4 Leds LED's on Digital output pins 3,4,5,6</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">#define</span><span class="c1" style="font-size: 10pt;">&nbsp;LED2 4</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">#define LED3 5</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">#define LED4 6</span></p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">int sound;</span></p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c15 c1" style="color: #b45f06; font-size: 10pt;">void&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">setup</span><span class="c1" style="font-size: 10pt;">()</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">{</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">&nbsp; // initialize the serial communications:</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">Serial.begin</span><span class="c1" style="font-size: 10pt;">(9600);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">&nbsp; // Provide power by using the analog inputs as normal digital pins. &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">pinMode</span><span class="c1" style="font-size: 10pt;">(soundpin,&nbsp;</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">INPUT</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">pinMode</span><span class="c1" style="font-size: 10pt;">(LED1,&nbsp;</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">OUTPUT</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">pinMode</span><span class="c1" style="font-size: 10pt;">(LED2,&nbsp;</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">OUTPUT</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">pinMode</span><span class="c1" style="font-size: 10pt;">(LED3,&nbsp;</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">OUTPUT</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">pinMode</span><span class="c1" style="font-size: 10pt;">(LED4,&nbsp;</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">OUTPUT</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">}</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1 c15" style="color: #b45f06; font-size: 10pt;">void&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">loop</span><span class="c1" style="font-size: 10pt;">()</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">{</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; sound=</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">analogRead</span><span class="c1" style="font-size: 10pt;">(soundpin); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// this samples the sound constantly</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">if</span><span class="c1" style="font-size: 10pt;">((sound)&gt;200)</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED1,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c1 c5" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LEDs on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED2,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED3,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED4,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">else if</span><span class="c1" style="font-size: 10pt;">((sound)&gt;150)</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED1,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LED on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED2,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED3,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED4,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LED off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">else if</span><span class="c1" style="font-size: 10pt;">(sound&gt;100)</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED1,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LED on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED2,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED3,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LED off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED4,</span><span class="c1 c8" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">else if</span><span class="c1" style="font-size: 10pt;">(sound&gt;50)</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED1,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">HIGH</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LED on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED2,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LED of</span><span class="c1" style="font-size: 10pt;">f</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED3,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED4,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">else</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED1,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">); &nbsp;&nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// set the LEDs off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED2,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED3,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c2" style="color: #b45f06; font-weight: bold; font-size: 10pt;">digitalWrite</span><span class="c1" style="font-size: 10pt;">(LED4,</span><span class="c8 c1" style="color: #0b5394; font-weight: bold; font-size: 10pt;">LOW</span><span class="c1" style="font-size: 10pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp; &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">Serial.println</span><span class="c1" style="font-size: 10pt;">(</span><span class="c1" style="font-size: 10pt;">soundpin); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">//output for serial monitor</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">&nbsp; &nbsp; &nbsp;</span><span class="c2 c1" style="color: #b45f06; font-weight: bold; font-size: 10pt;">delay</span><span class="c1" style="font-size: 10pt;">(25); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="c5 c1" style="color: #274e13; font-weight: bold; font-size: 10pt;">// And a shot delay</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c1" style="font-size: 10pt;">}</span></p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr;">&nbsp;</p></td></tr></tbody></table><p class="c0 c3" style="margin: 0px; height: 11pt; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c3 c0" style="margin: 0px; height: 11pt; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c18" style="font-size: 8pt;">Links to projects that helped with getting this project working.</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c7" style="color: #000099; font-size: 8pt; text-decoration: underline;"><a href="http://www.instructables.com/id/VU-Meter/" class="c6" style="text-decoration: inherit;">http://www.instructables.com/id/VU-Meter/</a></span><span class="c18" style="font-size: 8pt;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c7" style="color: #000099; font-size: 8pt; text-decoration: underline;"><a href="http://arduinoarts.com/2011/08/uv-meter/" class="c6" style="text-decoration: inherit;">http://arduinoarts.com/2011/08/uv-meter/</a></span></p><div>&nbsp;</div><div><strong><span style="font-size: 14px;"><a href="http://www.hobbyist.co.nz/?q=interfacing-relay-modules-to-arduino">Next Step: Interfacing relay modules to Arduino</a></span></strong></div>

body_summary:
  <p>
  	Making the LED lights dance to your music, this project connects your Arduino to your sterio and makes the LED lights dance to the volume level.</p>


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <p>&nbsp;</p><div><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">To connect the 4 Relay board to an Arduino is very easy. &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">You only need to connect the Arduino +5v to the 4 Relay board VCC pin and an Arduino Ground to the 4 Relay board GND pin.</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">Then it’s a matter of just connecting some data pins from the Arduino to the 4 Relay board IN pins.</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">In the example code below I used Arduino pins 7, 8 , 9, 10.</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">I didn’t use the same digital pins as the LEDs because they are inversed to each other. &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">The LEDs get power from the Arduino, that means when the digital pin is HIGH (1) it has +5v on the line and the LED lights up.</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">The relay commands are the opposite to this and the relay is switched with the IN pin is set LOW (0).</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">The relays default state is to connect COM to NC (normally closed), this is also done by setting the relays IN pin HIGH. &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">This is a safety feature in-case you Arduino looses power it turns off all the relay switches. &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">To change the relays state so NO (Normally Open) the pin is set to LOW.</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">I have some 12v DC lights that I want to activate like LEDs as a VU meter.</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">To do that I connect the lights power line to the 4 Relay board relay Com connector and</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c2" style="color: #242424; font-size: 12pt;">the line to the lights connects to the relays NO connector. &nbsp;The NC connect is left empty.</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><h5 class="c0" style="padding-top: 11pt; color: #000000; font-size: 11pt; font-family: Arial; padding-bottom: 2pt; direction: ltr;">Example of connecting Lights to the relays.</h5><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><a href="/sites/default/files/pictures/dancing-lights/dancinglights_step3.jpg"><img src="/sites/default/files/pictures/dancing-lights/dancinglights_step3.jpg" title="Click to see full sized image" width="600" height="413" /></a></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><table class="c14" style="border-collapse: collapse; font-family: Arial; width: 657px;" cellspacing="0" cellpadding="0"><tbody><tr><td class="c17" style="vertical-align: top; width: 641px; border: 1pt solid #000000; padding: 5pt;"><p class="c0" style="margin: 0px; direction: ltr;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// Relay controlled Danceing Lights</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// <span style="font-size: 12px;">Based on code from http://www.instructables.com/id/VU-Meter/</span></span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define soundpin &nbsp;8 &nbsp;&nbsp;&nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// &nbsp;reads the power from the light sensor from Analog input 0</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define LED1 3 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// &nbsp;4 LED's on Digital output pins 3,4,5,6</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define LED2 4</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define LED3 5</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define LED4 6</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define RELAY1 7 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// &nbsp;4 Digital pins on the Arduino 7,8,9,10</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define RELAY2 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// &nbsp;These pins link to 4 Relay board IN pins 1,2,3,4</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define RELAY3 9</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">#define RELAY4 10</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// define the sampling variable</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">int sound;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// arduino pin 13 LED flash. This goes on or off each time relays are updated</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">int flash =&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c4" style="color: #e69138; font-size: 12pt;">void&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">setup</span><span class="c2" style="color: #242424; font-size: 12pt;">()</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">{</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">&nbsp; // initialize the serial communications for diagnostic output</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">Serial.begin</span><span class="c2" style="color: #242424; font-size: 12pt;">(9600);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">&nbsp; // Provide power by using the analog inputs as normal digital pins. &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(soundpin,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">INPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED1,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED2,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED3,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED4,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY1,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY2,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY3,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY4,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">pinMode</span><span class="c2" style="color: #242424; font-size: 12pt;">(13,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">OUTPUT</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">}</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c4" style="color: #e69138; font-size: 12pt;">void&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">loop</span><span class="c2" style="color: #242424; font-size: 12pt;">()</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">{</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; sound=</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">analogRead</span><span class="c2" style="color: #242424; font-size: 12pt;">(soundpin);</span><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp;&nbsp;</span><span style="color: #006400;"><span class="c2" style="font-size: 12pt;"><strong>// read current sound level</strong></span></span></p><p class="c0" style="margin: 0px; direction: ltr;"><span style="font-family: Arial;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">Serial.println</span><span class="c2" style="color: #242424; font-size: 12pt;">(</span><span class="c2" style="color: #242424; font-size: 12pt;">sound); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// send the value of the sound level to the serial port.</span><span class="c11" style="color: #38761d; font-size: 12pt;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c8" style="text-indent: 48px; color: #38761d; font-size: 12pt; font-weight: bold;">&nbsp; // The above output will help to calibrate the the vu levels if your music is quieter</span><span class="c11" style="text-indent: 48px; color: #38761d; font-size: 12pt;">&nbsp;</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;"><br /></span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;"><br /></span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">&nbsp; // below toggles the flash variable with a logical not operation.</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;"><span style="color: #38761d; font-size: medium;"><strong><br /></strong></span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; flash=!flash; &nbsp;&nbsp;</span><span style="color: #38761d; font-family: Arial; font-size: 16px; font-style: normal; font-weight: bold;">// True (1) &nbsp;become False (0) and then reversed.</span><span style="color: #242424; font-size: 12pt; font-family: Arial;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(13, flash);</span><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">&nbsp; // loud level - from viewing the serial log the max level is around 300 for me</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">if</span><span class="c2" style="color: #242424; font-size: 12pt;">((sound)&gt;200) &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c11" style="color: #38761d; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; </span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LEDs on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// Turns the Relays on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">else if</span><span class="c2" style="color: #242424; font-size: 12pt;">((sound)&gt;150)</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LED on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED4,&nbsp;</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LED off</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// turns the Relays on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// turns the Relay off</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">else if</span><span class="c2" style="color: #242424; font-size: 12pt;">(sound&gt;100)</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LED on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LED off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// turns the Relays on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// turns the Relays off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">else if</span><span class="c2" style="color: #242424; font-size: 12pt;">(sound&gt;50) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// sound below this level will turn off all leds / relays&nbsp; </span><br /> <span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// you can reduce this to have at least one led/relay most of the time.</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LED on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LED off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// turnset the Relays on</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// turns the Relays off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">else&nbsp;</span><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// sound below 50 equals no leds / relays on.</span><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// set the LEDs off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(LED4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">LOW</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY1,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">); &nbsp; &nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;">// turns the Relays off</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY2,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY3,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">digitalWrite</span><span class="c2" style="color: #242424; font-size: 12pt;">(RELAY4,</span><span class="c7" style="color: #0b5394; font-size: 12pt; font-weight: bold;">HIGH</span><span class="c2" style="color: #242424; font-size: 12pt;">);</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp; &nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp;&nbsp;</span><span class="c3" style="color: #e69138; font-size: 12pt; font-weight: bold;">delay</span><span class="c2" style="color: #242424; font-size: 12pt;">(1000); &nbsp;&nbsp;</span><span style="color: #38761d; font-family: Arial; font-size: 16px; font-style: normal; font-weight: bold;">// wait a second between changes to help protect the relay</span><span class="c2" style="color: #242424; font-size: 12pt;">&nbsp; &nbsp;</span><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;"></span></p><p class="c0" style="margin: 0px; direction: ltr;"><span class="c8" style="color: #38761d; font-size: 12pt; font-weight: bold;"></span><span style="color: #242424; font-size: 12pt; font-family: Arial;">}</span></p></td></tr></tbody></table><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">Other Details:</p><h4 class="c0" style="padding-top: 12pt; color: #000000; font-size: 12pt; font-family: Arial; padding-bottom: 2pt; direction: ltr;"><span class="c23" style="background-color: #fcfcfc;">Specification of 4 Relay board:</span></h4><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c9" style="font-size: 10pt; background-color: #fcfcfc;">Equipped with high-current relay, AC250V 10A ; DC30V 10A</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c9" style="font-size: 10pt; background-color: #fcfcfc;">Support 5V voltage</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c9" style="font-size: 10pt; background-color: #fcfcfc;">Independent wiring in contact area , safe and reliable</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c9" style="font-size: 10pt; background-color: #fcfcfc;">Standard interface that can be expanded in a variety of development boards</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c9" style="font-size: 10pt; background-color: #fcfcfc;">Equipped with screw holes for easy installation</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c9" style="font-size: 10pt; background-color: #fcfcfc;">Applicable to a variety of platforms including &nbsp; Arduino / AVR / ARM</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c12" style="color: #242424; font-size: 10pt;">Size: 7 X 4.9 X1.8 (high) cm</span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><h4 class="c0" style="padding-top: 12pt; color: #000000; font-size: 12pt; font-family: Arial; padding-bottom: 2pt; direction: ltr;">Schematic Diagram:</h4><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><img src="/sites/default/files/pictures/dancing-lights/schematic.jpg" width="640" height="647" /></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;">More information about relays:&nbsp;<span class="c16" style="color: #000099; text-decoration: underline;"><a href="http://www.kpsec.freeuk.com/components/relay.htm" class="c13" style="text-decoration: inherit;">http://www.kpsec.freeuk.com/components/relay.htm</a></span></p><p class="c0 c1" style="margin: 0px; direction: ltr; height: 11pt; color: #000000; font-family: Arial; font-size: 15px;">&nbsp;</p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c10" style="color: #cc0000; font-size: 12pt;">Tips on working with AC power: &nbsp;</span><span class="c19" style="color: #ff0000; font-size: 12pt; font-weight: bold; background-color: #ffffff;">&nbsp;… IT IS DANGEROUS !!!... &nbsp;&nbsp;</span><span class="c10" style="color: #cc0000; font-size: 12pt;">&nbsp;</span></p><p class="c0" style="margin: 0px; direction: ltr; color: #000000; font-family: Arial; font-size: 15px;"><span class="c10" style="color: #cc0000; font-size: 12pt;">Only work with AC if you really know what your doing, it can kill.</span></p></div><div>&nbsp;</div><div><a href="http://www.hobbyist.co.nz/?q=interfacing-relay-modules-to-arduino"><span style="font-size: 14px;"><strong>Previous Step: Interfacing relay modules to Arduino </strong></span></a></div><div>&nbsp;</div><div><a href="http://www.hobbyist.co.nz/?q=dancing-lights"><strong><span style="color: #006400;"><span style="font-size: 18px;">Get yourself the dancing lights now</span></span></strong></a></div><p>&nbsp;</p>


entity_type: node
bundle: page
language: und
body_format: full_html
body_value:
  <p>We are physically located in Ilam, Christchurch, New Zealand. This store aims to supply electronic development boards at low price. Our products are the must-have building blocks for electronic &amp; robotic hobbyists or for someone who wants to use microcontrollers to bring their brilliant ideas to reality.</p><p>We exactly understand the low budget requirements when hobbyists are searching for parts.Here we are, this store commits to supply you parts at the lowest price possible. These are two things we do to save you money.</p><ul><li><span style="font-size: 14px;"><span style="color: #0066ff;"><strong>F<strong>la</strong>t shipping rate of $3.50</strong>&nbsp;<strong>Nationwide (NZ)</strong></span></span><ul><li>No matter how many items you buy, <em><strong>F<strong>la</strong>t shipping rate is $3.50</strong></em> nationwide, and pickup is welcome.</li></ul></li></ul><ul><li><span style="font-size: 14px;"><span style="color: #0066ff;"><strong>We will beat it by 10%</strong>.</span></span><ul><li>If you find any identical product that is sold in New Zealand at a lower price, <em><strong>we will beat it by 10%</strong></em>. Our product range is constantly expanding, more variety of parts, development boards and combo kits will be introduced over time, so please come back often to get the latest update of our catalog.</li></ul></li></ul><p><strong><br /></strong></p>


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <p><span style="font-size: medium;"><strong>Move the mouse along the picture to get more info of the components,&nbsp;</strong></span></p><p><strong><img usemap="#imgmap20122119274" src="/sites/default/files/arduino-uno-microcontroller-2-B.jpg" border="0" alt="ARduino Uno" width="400" height="400" /></strong></p><p><strong><map id="imgmap20122119274" name="imgmap20122119274"><area shape="poly" title="Atmega chip" alt="" coords="218,192,335,110,360,125,239,213" target="" /><area shape="poly" title="Power : Click ME" alt="" coords="124,283,180,245,221,280,164,319" href="/?q=power-adapter" target="_blank" /><area shape="poly" title="Crystal" alt="" coords="111,215,147,191,163,203,127,225" target="" /><area shape="circle" title="Capacitor 1" alt="" coords="259,239,14" target="" /><area shape="circle" title="Capacitor 2" alt="" coords="233,260,13" target="" /><area shape="poly" title="USB port" alt="" coords="10,204,42,235,48,269,110,230,104,192,71,167,65,169" target="" /></map></strong></p><p></p><p><span style="font-size: medium;">Click the power socket and check what happens&nbsp;</span></p>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-family: verdana, geneva; font-size: medium;">The Arduino Motorshield is the missing link for making a robot with the arduino. This Arduino Motorshield allows you to connect 2 DC motors and have total control of them from the arduino.</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> It allows you to move each DC motor</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Clockwise</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - AntiClockwise</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Stall</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Control motor speed</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> This motor shield allows Arduino to drive two channel DC motors. It uses a L293P chip which</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> deliveries output current up to 2A each channel. The speed control is achieved through conventional PWM which can be obtained from Arduinos PWM output Pin 5 and 6.</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> Specs:</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> Peak Output Current (each Channel)</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Non Repetitive (t = 100ms): 3A</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> -Repetitive (80% on -20% off; ton = 10ms): 2.5A</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> -DC Operation: 2A</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> Analog voltage input: VIN 6.5-12V PWRIN 4.8-24V&nbsp;</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> Digital voltage input: VD = 5V (7V max)</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> Max power dissipation: 25W</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">See&nbsp; <a href="http://www.hobbyist.co.nz/?q=motor-shield-tutorial">Motor Shield Tutorial</a> for details of how to use it.</span></p>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-family: verdana, geneva; font-size: medium;">For beginners, this is a must have! It's so good value for money.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">This Protoshield we offer comes with a</span></p><ul><li><span style="font-family: verdana, geneva; font-size: medium;">Arduino compatible prototyping board</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">mini breadboard and approx.</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">70 pcs of breadboard wires.</span></li></ul><p><span style="font-family: verdana, geneva; font-size: medium;">It has everything you need to get started prototyping your circuit right away. No soldering is required!</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">Once the circuit is working and you want to make it permanent, you can solder the components onto the prototyping board.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">The prototyping board has heaps of very cool features to make prototyping on your Arduino easy.</span></p><ol><li><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;Compatible with NG, Diecimila, Duemilanove and any Arduino-clone in the 'classic' shape and pinout</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;Reset button up top * ICSP header * Lots of GND and +5V rails</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;DIP prototyping area makes it easy to add more chips</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;SOIC prototyping area above USB jack for up to 14-pin SOIC chip, narrow medium or wide package.</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;Two 3mm LEDs with matching resistors</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;Extra 6mm button</span></li></ol>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-family: verdana, geneva; font-size: medium;">For some applications a bit of color can make all the difference! Here you go, this is colored version of the Arduino LCD shield. It comes with three push buttons on the topper for user inputs.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">Now you can run an interactive color application on the Arduino, taking the COOLNESS to a new level....</span></p><ul><li><span style="font-family: verdana, geneva; font-size: medium;"><a href="http://hobbyist.co.nz/sites/default/files/color_LCD_sample_code.rar">Example code</a></span></li></ul><ul><li><span style="font-family: verdana, geneva; font-size: medium;"><a href="http://hobbyist.co.nz/sites/default/files/color_LCD_schematics.pdf">Schematics &amp; pin outs</a></span></li></ul><p><span style="font-family: verdana, geneva; font-size: medium;">This 132x132 mini color LCD is a perfect match for the&nbsp; portable application. Please be gentle with it and handle it with care.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">This inexpensive LCD comes with a powerful white LED backlight and a relatively simple serial interface.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;"><strong>Frame Dimensions:</strong>&nbsp;1.35x1.58"</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> <strong>Active Display Dimensions:</strong>&nbsp;1.2"x1.2"</span></p><p><span style="font-family: verdana, geneva; font-size: medium;"><strong>Features:</strong></span></p><ul><li><span style="font-family: verdana, geneva; font-size: medium;">LCD Logic - 3.3V @ 2-3mA</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">LED Backlight - 7V @ 40-50mA (very bright)</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Full 4,096 Color Display</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Uses the Epson S1D15G10 or Philips PCF8833 Controller (we cannot guarantee which one you will receive, please see Jim Lynch's tutorial below as to why)</span></li></ul><p><span style="font-family: verdana, geneva; font-size: medium;"><strong>Documents:</strong></span></p><ul><li><span style="font-family: verdana, geneva; font-size: medium;">Latest&nbsp;<a href="http://www.sparkfun.com/Code/Nokia_LCD_driver.zip" style="color: #17426b; font-weight: normal; text-decoration: none;">LPC2148</a>&nbsp;example code from SFE, works with both controllers</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Latest&nbsp;<a href="http://www.sparkfun.com/datasheets/LCD/SFE_lcd_driver_c.zip" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">ATmega8 example</a>&nbsp;code from SFE, works with Epson controller</span></li><li><span style="font-family: verdana, geneva; font-size: medium;"><a href="http://www.sparkfun.com/tutorial/Nokia%206100%20LCD%20Display%20Driver.pdf" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">Interface tutorial</a>&nbsp;by Jim Lynch</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Epson Controller&nbsp;<a href="http://www.sparkfun.com/datasheets/LCD/S1D15G10D08BE_TM_MF1493_03.pdf" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">Datasheet</a></span></li><li><span style="font-family: verdana, geneva; font-size: medium;"><a href="http://www.opencircuits.com/SFE_Footprint_Library_Eagle" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">SFE Eagle Library</a>&nbsp;has this part!</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">The&nbsp;<a href="http://forum.lcdinfo.com/viewtopic.php?t=586" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">holy grail forum posting</a>&nbsp;for this Nokia type LCD</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.sparkfun.com/datasheets/LCD/Jimbo-Nokia-Atmel-Example.rar" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">ATMega32 Code</a>&nbsp;- Thanks Jimbo!</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.sparkfun.com/datasheets/LCD/Jimbo-Nokia-SAM7-Example.zip" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">SAM7-P64 ARM Code</a>&nbsp;- Thanks again Jimbo!</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.pyrofersprojects.com/3dcube.php" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">3D Graphics project</a>&nbsp;on a PIC</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.idleloop.com/robotics/ColorLCD/" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">ATMega644/128/32/16 code</a>&nbsp;- Care of&nbsp;<a href="http://www.robothon.com/" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">Cathy</a></span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.sparkfun.com/datasheets/LCD/nokial6100_ccs_c.zip" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">PIC 16F87x code</a>&nbsp;for CCS Compiler - Thanks Marcus</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.germinara.it/fgio_usb.htm" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">PIC 18F4550 USB</a>&nbsp;- Thanks Francesco</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.idcomm.com/personal/lorenblaney/sparkfun.html" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">4096 Color Control</a>&nbsp;- Beautiful! Thanks Loren Blaney</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://linuxmaximus.blogspot.com/2008/05/nokia-6100-lcd-linux-driver.html" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">Linux Driver</a>&nbsp;- Thanks Zsolt</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Example&nbsp;<a href="http://www.random-i.com/NokiaLCD/" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">Image Converter</a></span><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;- Thanks Jamie Samayoa</span></li><li><span style="font-family: verdana, geneva; font-size: medium;"><a href="http://www.zipfelmaus.com/nokia6100lcd_en/" target="_blank" style="color: #17426b; font-weight: normal; text-decoration: none;">Bitmap Converter</a>&nbsp;- Thanks Sebastian</span></li></ul><p><span style="font-family: verdana, geneva; font-size: medium;"><strong>Pin Out (use the numbering visible on the display connector):</strong></span></p><ol><li><span style="font-family: verdana, geneva; font-size: medium;">VCC-Digital (3.3V)</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">RESET</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">SDATA</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">SCK</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">CS</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">VCC-Display (3.3V)</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">N/C</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">GND</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">LED GND</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">LED V+ (6-7V)</span></li></ol>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p>The Mars rover platform is a robust and easily adjustable (manually) track drive chassis that is perfect for robotics hobbyists.</p><p>It has two DC motor built-in, and it's already assembled. A 6-slot battery case is also included.</p><p>The height of the track wheels are adjustable.</p><p>Dimension: 245mm length x 225mm width x 74mm height</p><p>The batteries are not included.</p><p>Check out other products to get a Arduino and Motorshield to build a complete programmable platform!</p><p>specs provided by the manufacturer:</p><ul><li><span style="font-size: 9pt;">Dimensions: </span>245mm length x 225mm width x 74mm height</li><li><span style="font-size: 12px;">Adjustable height: </span><span style="font-size: 12px;">74mm-100mm</span></li><li><span style="font-size: 12px;">Ground clearance: 21mm-50mm</span></li><li><span style="font-size: 9pt;">Operating voltage: 7.2V</span></li><li><span style="font-size: 9pt;">Operating current: 160–180 mA</span></li><li><span style="font-size: 9pt;">Maximum speed: 30 cm/s(speed can reach 42cm/s </span><span style="font-size: 9pt;">at 12 V</span><span style="font-size: 9pt;">)</span></li><li><span style="font-size: 9pt;">Maximum climbing angle: &gt; 30°</span></li><li><span style="font-size: 9pt;">Maximum payload: &gt; 7.5Kg</span></li></ul><p>Note: the specs above should only used be as a reference, performance of individual platform may vary due to manufacturing tolerance, battery type and operating conditions.</p><p><a title="robotics, robot games, make a robot, build a robot, kid robot, mr robot, create a robot, robot wars">..</a></p>


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <p>&nbsp;</p><p><img src="http://www.hobbyist.co.nz/sites/default/files/pictures/l298-motor-controller/L298.jpg" border="0" alt="" width="570" height="468" /></p><p><span style="font-size: small; font-family: verdana,geneva;">This article explains how the +5 V and Vcc of this motor controller work.</span></p><p><span style="font-size: small; font-family: verdana,geneva;">All motor contorller circuits have two voltage levels. One is a high voltage (typ. 12 or 24 V) that use as the motor supply voltage, that is, the voltage that drives the motors. The other voltage level is typically a 5 V, which powers the electronics of on the motor controller, including the H-bridge, diodes, and LEDs etc. Depending on the connection of the two jumpers J3 and J5, there are three operating modes of using this motor controller. When working with this motor controller we strongly encourage you to check the voltage lines with a multimeter before connecting it to anything, otherwise a faulty motor controller may damage the devices connecting to it.</span></p><p><span style="font-size: small; font-family: verdana,geneva;"><br /></span></p><p><strong><span style="font-size: small; font-family: verdana,geneva;">Mode 1, jumper J3 and J5 open circuit</span></strong></p><p><span style="font-size: small; font-family: verdana,geneva;">In this mode, Vcc is the motor supply voltage, accepting a voltage range from 5 to 35 V. When the supply voltage is connected, </span><span style="font-size: small; font-family: verdana,geneva;">the LED D1 is off. (if the LED is on, the controller may be faulty). </span><span style="font-size: small; font-family: verdana,geneva;">The terminal +5 V is an input, a +5 V power source is needed to connect to it in order to power the electronics of the controller.</span></p><p><span style="font-size: small; font-family: verdana,geneva;"><br /></span></p><p><strong><span style="font-size: small; font-family: verdana,geneva;">Mode 2, jumper J3 short circuit, J5 open circuit</span></strong></p><p><span style="font-size: small; font-family: verdana,geneva;">In this mode, Vcc is the motor supply voltage, accepting a voltage range from 7 to 35 V. When the supply voltage is connected, </span><span style="font-size: small; font-family: verdana,geneva;"> the LED D1 is on. </span><span style="font-size: small; font-family: verdana,geneva;">The Vcc voltage gets regulated to 5 V to power all the onboard electronics. The terminal +5 V , is an output.meaning that it makes a +5 V power source available for other electronics that need it, e.g. the Arduino microcontroller board.</span></p><p><span style="font-size: small; font-family: verdana,geneva;"><br /></span></p><p><strong><span style="font-size: small; font-family: verdana,geneva;">Mode 3, jumper J3 open circuit, J5 short circuit</span></strong></p><p><span style="font-size: small; font-family: verdana,geneva;">In this mode, Vcc is the motor supply voltage, accepting a voltage range from 7 to 35 V. When the supply voltage is connected, </span><span style="font-size: small; font-family: verdana,geneva;">the LED D1 is on. </span><span style="font-size: small; font-family: verdana,geneva;">The Vcc voltage gets regulated to 5 V to power all the onboard electronics. The terminal +5 V is output, but its voltage is <strong><span style="color: #ff0000;">equal</span></strong> to the Vcc voltage, so it on longer to be +5 V as labeled on the board. This mode is <strong>not</strong> recommended.</span></p><p><span style="font-size: small; font-family: verdana,geneva;"><br /></span></p><p><span style="font-size: small; font-family: verdana,geneva;">To understand how to control the motors, please see <a href="http://www.hobbyist.co.nz/?q=terminator-tutorial">this tutorial</a> where an example code is available.</span></p><p>&nbsp;</p>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-size: medium; font-family: verdana, geneva;">You can easily connect with usual analog sensors by using this expansion board, such as temperature sensor. Those 3-way male pins allow you to connect servo motors. </span></p><p><span style="font-size: medium; font-family: verdana, geneva;">Everything is plug and play, and it's designed to be Arduino Duemilanove compatible. So all you need to do is to read the data from the sensors and output PWM to drive the servos by program in arduino. </span></p><p><span style="font-size: medium; font-family: verdana, geneva;">This is the latest version of sensor shield in the market. The major improvement over its predecessor is the power source. </span></p><p><span style="font-size: medium; font-family: verdana, geneva;">This version provides an external power connector so you don't need to worry about overloading the Arduino microcontroller while driving too many sensors and actuators.</span></p>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-size: large;"><strong><span style="font-family: verdana, geneva;">Web Switch: Control your kettle or any power appliance from the internet!!</span></strong></span></p><p><span style="font-size: medium;"><strong><span style="font-family: verdana, geneva;"><br /></span></strong></span></p><p><span style="font-family: verdana, geneva; font-size: medium;">This cool kit allows you to control any electric appliance from the internet.</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: medium;">What does that mean ?</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: medium;">That means you can turn ON/OFF any appliance at your home from your iphone, Android, ipad, PC or laptop from Anywhere in the world..As long as you have access to a web browser.</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: medium;">Woooo..aint that an amazing power to lay your hands on.</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: medium;">Kit contents:</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;<img src="sites/default/files/webswitch/Arduino_small.jpg" border="0" alt="Arduino" width="200" />&nbsp;&nbsp;<img src="sites/default/files/webswitch/Ethernet_shield_small.jpg" border="0" width="200" />&nbsp;</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span style="font-style: inherit; line-height: 1.3em;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><strong style="font-style: inherit; line-height: 1.3em;">&nbsp;&nbsp;Arduino &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ethernet shield &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</strong></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: small;">&nbsp;<img src="sites/default/files/webswitch/Sensor_shield_small.jpg" border="0" width="200" />&nbsp; &nbsp; &nbsp;</span><span style="font-family: verdana, geneva; font-size: small; font-style: inherit; line-height: 1.3em;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><img src="sites/default/files/webswitch/Relay_small.jpg" border="0" width="200" /></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: small; font-style: inherit; line-height: 1.3em;"><span style="font-size: medium;"> &nbsp; &nbsp; &nbsp; &nbsp;<strong> Sensor Shield &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Relay Module</strong></span><strong>&nbsp;</strong></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: medium;">Completed kit looks like this:</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: small;"><img src="sites/default/files/webswitch/AD+ES+SS+RM_small.jpg" border="0" alt="" /></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-size: medium; font-family: verdana, geneva;"><strong>Tutorial</strong></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-size: medium; font-family: verdana, geneva;"><a href="http://www.hobbyist.co.nz/?q=web-switch-tutorial" target="_blank" title="Tutorial and Source Code">Tutorial and source code</a></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-size: medium; font-family: verdana, geneva;">Video of working kit :</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; line-height: 1.3em; border-width: 0px; padding: 0px;"><span style="font-family: verdana, geneva; font-size: small;"><iframe width="480" height="360" src="http://www.youtube.com/embed/PuB4hUmhmzg?cc_load_policy=1" frameborder="0"></iframe></span></p><p><span style="font-family: verdana, geneva; font-size: small;">&nbsp;</span></p>


entity_type: node
bundle: page
language: und
body_format: full_html
body_value:
  <p><strong><span style="font-size: medium;">Hobbyist is looking for enthusiasts who love building kits</span></strong></p><ul><li><span style="font-size: small;">Hobbyist sponsors and pays for all the kit and materials&nbsp;</span></li><li><span style="font-size: small;">You get paid for having fun and building the kit</span></li><li><span style="font-size: small;">Work flexible hours in the comfort of your home</span></li><li><span style="font-size: small;">You can suggest kits which you find cool, we will&nbsp;</span><span style="font-size: small;">pay you for building it</span></li></ul><p></p><p></p><p><strong><span style="font-size: medium;">How to start?</span></strong></p><p><span style="font-size: small;">Tell us about</span></p><ul><li><span style="font-size: small;">Yourself</span></li><li><span style="font-size: small;">Projects you have done ( if possible links to any of your published projects/blog )</span></li></ul><p><span style="font-size: small;">Drop us a mail at contact@hobbyist.co.nz&nbsp;</span><span style="font-size: small;">with above information and you will pretty soon be building cool projects with Hobbyist.</span></p>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <h2><strong>Bluetooth Module</strong> <strong>(Master):</strong></h2><p><img src="sites/default/files/pictures/bluetooth/bluetooth_with_wires.jpg" border="0" alt="" width="611" height="457" /></p><p><span style="font-size: small;">This is the HC-06 Bluetooth module, master. It can talk to the HC-06 Bluetooth module, device.</span></p><p><span style="font-size: small;">Please note:</span></p><ul><li><span style="font-size: small;">HC-06 master can only connect to HC-06 device.</span></li><li><span style="font-size: small;">The role of a HC-06 Bluetooth module master and a HC-06 Bluetooth device cannot be interchanged, its defifined in its firmware, which is proprietary.</span></li><li><span style="font-size: small;">The name of the master module cannot be changed, and other commands are the same as the <a href="http://www.hobbyist.co.nz/?q=Bluetooth-module-configurations">device module</a>.</span></li></ul><p><span style="font-size: small;">Once the master detects a slave module with the same paring code, it will establish the connection. and next time, even after power down, once the master module detect the same slave module, it will automatically connect to it even other slave modules are also nearby. The master module recognizes that specific slave module through it's MAC number. A master module that is mated with a slave module has a slow flashing LED. Once connection established, its LED stays on. To reset the MAC number, press the button on the master module, or give the 'key/wake' pin a logic high impulse. Once it's reset, and if there are more multiple slave modules in the vicinity with the same paring code, the master module will randomly pick one to connect, and will again, lock into that module until the reset button is pressed.</span></p><p>&nbsp;</p>


entity_type: node
bundle: page
language: und
body_format: full_html
body_value:
  <p><span style="font-size: medium; font-family: verdana, geneva;">The Networked Sensor is a kit which lets you put your sensors on the internet!</span></p><p><span style="font-family: verdana, geneva;"><font face="verdana, geneva" size="3"><br /></font></span></p><p><iframe width="600" height="600" src="sites/default/files/smoothie/smoothie.html"></iframe></p><p></p><p><a href="http://www.hobbyist.co.nz/sites/default/files/smoothie/smoothie.html" target="_blank" title="Networked sensor demo " style="font-family: verdana, geneva; font-size: medium;">Networked Sensor Demo page</a></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><strong><span style="font-size: large; font-family: verdana, geneva;"><font face="verdana, geneva" size="3"><br /></font></span></strong></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><strong><span style="font-size: large; font-family: verdana, geneva;"><font face="verdana, geneva" size="3">Applications:</font></span></strong></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-family: verdana, geneva; font-size: medium;">Access the cool graphs from anywhere in the world, Remotely you can see:</span></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-family: verdana, geneva; font-size: medium;"><br /></span></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-family: verdana, geneva; font-size: medium;"><strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;"><span style="font-family: verdana, geneva; font-size: medium;">&nbsp; &nbsp;&nbsp;</span></strong><strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;"><img src="/sites/default/files/Sprinkler.jpg" border="0" width="200" height="159" />&nbsp;</strong></span><em><span style="font-family: verdana, geneva; font-size: medium;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></em><strong><span style="font-family: verdana, geneva; font-size: medium;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></strong><strong><span style="font-family: verdana, geneva; font-size: medium;"><img src="/sites/default/files/HouseWinter.jpg" border="0" width="200" height="130" />&nbsp;</span></strong></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><strong><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;</span></strong><em><span style="font-family: verdana, geneva; font-size: medium;">Your Gardens humidity level &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></em><span style="font-family: verdana, geneva; font-size: medium;"><em>Home room temperature &nbsp;</em></span></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-family: verdana, geneva; font-size: medium;"><em>&nbsp; &nbsp; &nbsp; &nbsp;</em></span><strong><span style="font-family: verdana, geneva; font-size: medium;"><img src="/sites/default/files/Buglar%20Alarm.jpg" border="0" width="225" height="225" />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong><img src="/sites/default/files/Alarm_pic.jpg" border="0" width="100" height="100" />&nbsp;<img src="/sites/default/files/AlarmGreen.jpg" border="0" width="100" height="100" /><strong><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;&nbsp;</span></strong></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><strong><span style="font-family: verdana, geneva; font-size: medium;"></span></strong><em><span style="font-family: verdana, geneva; font-size: medium;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Buglar alarm status</span></em></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"></p><p></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><strong><span style="font-family: verdana, geneva; font-size: medium;"><br /></span></strong></p><p><span style="font-family: verdana, geneva; font-size: medium;">- Real time power consumption</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">- Smoke sensor&nbsp;</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">- Water level monitor&nbsp;</span></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-family: verdana, geneva; font-size: medium;">- Any other Sensor you can think of, you could easily add it to this kit</span></p><p></p><div><span style="font-family: verdana, geneva; font-size: medium;"><br /></span></div><p></p><p><strong><span style="font-family: verdana, geneva;"><font face="verdana, geneva" size="3">Kit contents :</font></span></strong></p><p><span style="font-family: verdana, geneva;"><font face="verdana, geneva" size="3"><br /></font></span></p><p><span style="font-family: verdana, geneva;"><img src="/sites/default/files/EtherShield_0.jpg" border="0" width="200" height="200" /><font face="verdana, geneva" size="3"><img src="/sites/default/files/arduino_uno_cropped.png" border="0" width="200" height="110" /></font></span></p><p><span style="font-family: verdana, geneva;"><font face="verdana, geneva" size="3"><br /></font></span></p><p><span style="font-family: verdana, geneva;"><em><font face="verdana, geneva" size="3">&nbsp;Wiznet Etherent shield &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Arduino UNO</font></em></span></p><p><span style="font-family: verdana, geneva;"><em><font face="verdana, geneva" size="3"><br /></font></em></span></p><p><span style="font-family: verdana, geneva;"><em><font face="verdana, geneva" size="3">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<img src="/sites/default/files/12884965890_0.jpg" border="0" alt="Temperature &amp; Humidity Sensor ( Digital )" title="Temperature &amp; Humidity Sensor ( Digital )" width="282" height="282" /></font></em></span></p><p><span style="font-family: verdana, geneva;"><em><font face="verdana, geneva" size="3">Temperature and Humidity Sensor ( digital )</font></em></span></p><p><span style="font-family: verdana, geneva;"><font face="verdana, geneva" size="3"><br /></font></span></p><p><font face="verdana, geneva" size="3"><b><br /></b></font></p>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-family: verdana, geneva; font-size: medium;">This kit consists of an Arduino UNO and a black and white LCD shield. Being able to plug the LCD shield straight onto the Aduino making this setup clean and easy to work with. There is no wires hanging around. This is a great kit for someone to start learning some LCD based user interface. As on the shield it comes with a 5 degree of freedom joystick, which makes it easy to write up menus and click on them as you go.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">LCD shield give your project a Wow factor, last but not the least, it allows you to debug your programme while its running....</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">This package includes:</span></p><ul><li><span style="font-family: verdana, geneva; font-size: medium;"><strong>Arduino UNO</strong></span></li><li><span style="font-family: verdana, geneva; font-size: medium;"><strong>LCD shield</strong></span></li><li><span style="font-family: verdana, geneva; font-size: medium;"><strong>USB cable</strong></span></li></ul><p><span style="font-family: verdana, geneva; font-size: medium;">This <a href="http://hobbyist-repository.googlecode.com/svn/trunk/LCDshield/LCDshield_demo.pde">demo sketch</a> can get you started using this LCD shield.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">The library can be downloaded from <a href="http://www.hobbyist.co.nz/sites/default/files/LCD4884Lib.rar">here</a>.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">note: this library doesn't work with Arduino 1.0 software, please use Arduino software version 0022 or 0023.</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">First unzipped the LCD4884Lib.rar, then copy the sub-directory "LCD4884" and paste it to the directory "libraries" under the Arduino software directory.</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> Then launch the Arduino software, files -&gt; examples -&gt; LCD4884-&gt;LCD4884_menu</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> &nbsp;</span></p><p><span style="font-family: verdana, geneva; font-size: medium;"><strong>Specification</strong></span></p><ul><li><span style="font-family: verdana, geneva; font-size: medium;">Power Supply: 5V</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">SPI Interface (using Arduino Digital Pin 2,3,4,5,6)</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">One Reset button</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">One 5 degree joystick (using Arduino Analog Pin 0)</span></li><li><span style="font-family: verdana, geneva; font-size: medium;">Backlit control (Arduino DIO Pin 7)</span></li></ul><p><br /><span style="font-family: verdana, geneva; font-size: medium;"> <img src="http://www.hobbyist.co.nz/sites/default/files/bmp_on_lcd.jpg" border="0" alt="" /></span></p>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-size: medium;">Arduino infared proximity switch module is a reflection-type photoelectric sensor which integrates transmitting and receiving infared beams function. Infrared proximity switches work by sending out beams of invisible infrared light. A photodetector on the proximity switch detects any reflections of this light. These reflections allow infrared proximity switches to determine whether there is an object nearby. </span></p><p><span style="font-size: medium;"><br />The trigger distance can be anywhere between 30 - 800mm, by manual adjustment of the potentiometer in the sensor. <br /></span></p><p></p><h2><span class="mw-headline" style="font-size: medium;"> technical parameters</span></h2><ul><li><span style="font-size: medium;">Voltage&nbsp;:DC 5V </span></li><li><span style="font-size: medium;">Current &nbsp;:100mA </span></li><li><span style="font-size: medium;">Type&nbsp;:DC 3 Wire NPN-NO (Normal Open) </span></li><li><span style="font-size: medium;">Sensory Distance: 3-80 cm adjustable </span></li><li><span style="font-size: medium;">Sensory distance regulator and output indicator light on product back </span></li><li><span style="font-size: medium;">Control signal level: </span></li><li><span style="font-size: medium;">High：2.3V≤Vin≤5V </span></li><li><span style="font-size: medium;">Low：-0.3V≤Vin≤1.5V </span></li><li><span style="font-size: medium;">Ambient temperature: -25 - 70 degree C</span></li><li><span style="font-size: medium;">Guard mode: reverse polarity protection</span></li><li><span style="font-size: medium;">Sensor dimension: 18mm diameter x 45mm length<br /></span></li><li><span style="font-size: medium;">Cable length: 180mm<br /></span></li></ul><p><br /><img src="/sites/default/files/pictures/Infrared_proximity_sensor/Infared_proximity_switch1.jpg" border="0" alt="Infrared schematic" title="Infrared schematic" width="478" height="227" /></p><p></p><p><span style="font-size: medium;">Example code </span></p><p><span style="font-size: medium;"> int ledPin = 13; // choose pin for the LED</span><br /><span style="font-size: medium;">int inputPin = 2; // choose input pin (for Infrared sensor) </span><br /><span style="font-size: medium;">int val = 0; // variable for reading the pin status </span><br /><span style="font-size: medium;">void setup() </span><br /><span style="font-size: medium;">{ </span><br /><span style="font-size: medium;">&nbsp;&nbsp; pinMode(ledPin, OUTPUT); // declare LED as output </span><br /><span style="font-size: medium;">&nbsp;&nbsp; pinMode(inputPin, INPUT); // declare Infrared sensor as input</span><br /><span style="font-size: medium;">} </span><br /><span style="font-size: medium;">void loop()</span><br /><span style="font-size: medium;">{ </span><br /><span style="font-size: medium;">&nbsp;&nbsp; val = digitalRead(inputPin); // read input value </span><br /><span style="font-size: medium;">&nbsp;&nbsp; if (val == HIGH)</span><br /><span style="font-size: medium;">&nbsp;&nbsp; { // check if the input is HIGH</span><br /><span style="font-size: medium;">&nbsp; &nbsp; &nbsp; digitalWrite(ledPin, LOW); // turn LED OFF&nbsp;&nbsp; </span><br /><span style="font-size: medium;">&nbsp;&nbsp; } </span><br /><span style="font-size: medium;">&nbsp;&nbsp; else </span><br /><span style="font-size: medium;">&nbsp;&nbsp; { </span><br /><span style="font-size: medium;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(ledPin, HIGH); // turn LED ON </span><br /><span style="font-size: medium;">&nbsp;&nbsp; } </span><br /><span style="font-size: medium;">} </span></p>


entity_type: node
bundle: page
language: und
body_format: full_html
body_value:
  <h2 id="contents" style="font-family: Arial; font-size: 15px; margin: 6px;"><span style="font-size: medium;"><span class="c1" style="font-family: verdana,geneva;">RFID Kit Step 1: wiring up the LCD</span></span></h2><div style="font-family: Arial; font-size: 15px; margin: 6px;"><span style="font-size: medium;"><span class="c1" style="font-family: verdana,geneva;"><br /></span></span></div><div id="contents" style="font-family: Arial; font-size: 15px; margin: 6px;"><p class="c5" style="direction: ltr; margin: 0px;"><span class="c1" style="font-family: verdana, geneva; font-size: medium;">Below is the wiring diagram for connecting up a <a href="http://www.hobbyist.co.nz/?q=lcd-1620" target="_blank" title="Blue Backlit LCD display ( 16x2 characters )">LCD screen</a>, a buzzer and a button.</span></p><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">Connecting of the LCD screen is the same the LadyAda&nbsp;</span><span class="c18 c1" style="color: #1155cc; text-decoration: underline;"><a href="http://www.ladyada.net/learn/lcd/charlcd.html" title="LadyADA LCD tutorial" class="c10" style="text-decoration: inherit;">Wiring up a character LCD to an Arduino</a></span><span class="c1">. &nbsp;So I will not cover the ins and outs of that and just deal with the custom characters, buzzer and the button.</span></span></p><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">We use custom characters to display a countdown bar, each character is made up of 7 rows and 5 columns. &nbsp;</span><span class="c1">Below is a representation of the custom characters used from full to blank.</span></span></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1"><br /></span></span></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1"><img src="/sites/default/files/pictures/rfid_LCD_counts.png" border="0" alt="LCD screen display for count down" width="576" height="122" /></span></span></p><p class="c5" style="direction: ltr; margin: 0px;"><span class="c1" style="font-family: verdana, geneva; font-size: medium;">&nbsp;</span><span class="c1" style="font-family: verdana, geneva; font-size: medium;">&nbsp;</span></p><p class="c5" style="direction: ltr; margin: 0px;"><span class="c1" style="font-family: verdana, geneva; font-size: medium;">A line of 16 full custom characters are printed to the LCD, then one by one the last character on the display is replaced with the next custom character until it becomes blank and it moves onto reducing the next screen character position.</span></p><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"></p><p class="c5" style="direction: ltr; margin: 0px;"><span class="c1" style="font-family: verdana, geneva; font-size: medium;">As each segment is removed Pin 13 is changed from HIGH to LOW or LOW to HIGH causing the speaker to beep.</span></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">On the wiring diagram you can see I used a 200</span><span class="c1 c14 c7" style="color: #222222;">Ω resistor connected to the speaker so it’s not too alarming.</span></span></p><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">To start the LCD count down you just put the button. &nbsp;This button is wired up with a&nbsp;</span><span class="c18 c1" style="color: #1155cc; text-decoration: underline;"><a href="http://ikalogic.com/debouncing.php" class="c10" style="text-decoration: inherit;">hardware debounce,</a></span></span></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">which consists of a 10k</span><span class="c1 c7 c14" style="color: #222222;">Ω resistor and a 100nF ceramic capacitor.</span></span></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1 c7 c14" style="color: #222222;">Hint: if the count down starts right away without the button pressed, double check the wiring of the button for all connections.<br /></span></span></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1 c7 c14" style="color: #222222;"><br /></span></span></p><p class="c5" style="direction: ltr; margin: 0px;"><a href="/sites/default/files/pictures/lcd_button_buzz.png"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1 c7 c14" style="color: #222222;"><img src="/sites/default/files/pictures/lcd_button_buzz.png" border="0" alt="Wiring details" width="660" height="319" /></span></span></a></p><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"><span style="color: #333333; font-family: Verdana; font-size: 12px; line-height: 15px; white-space: pre-wrap; background-color: #fcfcfc;">Click to see larger Image</span></p><p class="c5" style="direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;">&nbsp;</span></p><p class="c5" style="direction: ltr; margin: 0px;"><a href="/sites/default/files/pictures/RFID_kit/Step1_LCD%20%28Medium%29.jpg"><span style="font-family: verdana, geneva; font-size: medium;"><img src="/sites/default/files/pictures/RFID_kit/Step1_LCD%20%28Medium%29.jpg" border="0" alt="step1_LCD" title="step1_LCD" width="641" height="554" /></span></a></p><table class="c20" style="font-family: Arial; font-size: 15px; border-collapse: collapse; width: 660px;" cellpadding="0" cellspacing="0"><tbody><tr><td class="c19" style="vertical-align: middle; width: 555.3pt; background-color: #fce5cd; border-width: 1pt; border-color: #000000; border-style: solid; padding: 5pt;"><p class="c4" style="line-height: 1; direction: ltr; margin: 0px;"><span class="c1" style="font-family: verdana, geneva; font-size: medium;">// &nbsp;LCD count down with button and beeper.</span></p><p class="c4 c12" style="line-height: 1; direction: ltr; height: 11pt; margin: 0px;"></p><p class="c4" style="line-height: 1; direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">#include &lt;</span><span class="c0" style="color: #cc6600;">LiquidCrystal</span><span class="c1">.h&gt;<br /><br /></span><span class="c1 c3" style="color: #7e7e7e;">// initialize the library with the numbers of the interface pins</span><span class="c1"><br /></span><span class="c0" style="color: #cc6600;">LiquidCrystal</span><span class="c1">&nbsp;lcd(7, 8, 9, 10, 11, 12);<br /><br /></span><span class="c0" style="color: #cc6600;">byte</span><span class="c1">&nbsp;ch0[8]={B11111,B11111,B11111,B11111,B11111,B11111,B11111,0};<br /></span><span class="c0" style="color: #cc6600;">byte</span><span class="c1">&nbsp;ch1[8]={B11110,B11110,B11110,B11110,B11110,B11110,B11110,0};<br /></span><span class="c0" style="color: #cc6600;">byte</span><span class="c1">&nbsp;ch2[8]={B11100,B11100,B11100,B11100,B11100,B11100,B11100,0};<br /></span><span class="c0" style="color: #cc6600;">byte</span><span class="c1">&nbsp;ch3[8]={B11000,B11000,B11000,B11000,B11000,B11000,B11000,0};<br /></span><span class="c0" style="color: #cc6600;">byte</span><span class="c1">&nbsp;ch4[8]={B10000,B10000,B10000,B10000,B10000,B10000,B10000,0};<br /></span><span class="c0" style="color: #cc6600;">byte</span><span class="c1">&nbsp;ch5[8]={B00000,B00000,B00000,B00000,B00000,B00000,B00000,0};<br />&nbsp;&nbsp;<br /></span><span class="c0" style="color: #cc6600;">int</span><span class="c1">&nbsp;beeper = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// Beeper flag. 0 = off</span><span class="c1"><br /><br /></span><span class="c0" style="color: #cc6600;">void</span><span class="c1">&nbsp;</span><span class="c0 c2" style="color: #cc6600; font-weight: bold;">setup</span><span class="c1">()<br />{<br />&nbsp;</span><span class="c0" style="color: #cc6600;">pinMode</span><span class="c1">(13,&nbsp;</span><span class="c1 c8" style="color: #006699;">OUTPUT</span><span class="c1">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// Door beeper</span><span class="c1"><br />&nbsp;</span><span class="c0" style="color: #cc6600;">pinMode</span><span class="c1">(A5,&nbsp;</span><span class="c1 c8" style="color: #006699;">INPUT</span><span class="c1">); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// Button input</span><span class="c1"><br /><br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">begin</span><span class="c1">(16, 2); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// Set up the LCD's number of columns and rows:&nbsp;</span><span class="c1"><br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">print</span><span class="c1">(</span><span class="c1 c8" style="color: #006699;">"LCD Button test"</span><span class="c1">); &nbsp; &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// Print startup message to the LCD.</span><span class="c1"><br /><br />&nbsp;</span><span class="c0 c2" style="color: #cc6600; font-weight: bold;">Serial</span><span class="c1">.</span><span class="c0" style="color: #cc6600;">begin</span><span class="c1">(19200); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// Serial debugging 19200 baud,&nbsp;</span><span style="color: #7e7e7e; line-height: 16px;">the speed the RFID card communicates at.</span><span style="color: #7e7e7e; line-height: 1;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span></p><p class="c4" style="line-height: 1; direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">&nbsp;</span><span class="c0 c2" style="color: #cc6600; font-weight: bold;">Serial</span><span class="c1">.</span><span class="c0" style="color: #cc6600;">println</span><span class="c1">(</span><span class="c1 c8" style="color: #006699;">"Serial Ready"</span><span class="c1">);<br />&nbsp;<br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">createChar</span><span class="c1">(0, ch0); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// initialise our custom characters</span><span class="c1"><br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">createChar</span><span class="c1">(1, ch1);<br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">createChar</span><span class="c1">(2, ch2);<br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">createChar</span><span class="c1">(3, ch3);<br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">createChar</span><span class="c1">(4, ch4);<br />&nbsp;lcd.</span><span class="c0" style="color: #cc6600;">createChar</span><span class="c1">(5, ch5);<br />}&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// end setup</span><span class="c1"><br /></span></span></p><p class="c4" style="line-height: 1; direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1"><br /></span></span></p><p class="c4" style="line-height: 1; direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1"><br /></span><span class="c0" style="color: #cc6600;">void</span><span class="c1">&nbsp;</span><span class="c0 c2" style="color: #cc6600; font-weight: bold;">loop</span><span class="c1">()<br />{<br />&nbsp;</span><span class="c0" style="color: #cc6600;">boolean</span><span class="c1">&nbsp;buttonState =&nbsp;</span><span class="c0" style="color: #cc6600;">digitalRead</span><span class="c1">(A5);&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// get button state</span><span class="c1"><br />&nbsp;buttonState =! buttonState; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// Invert button state to match logic</span><span class="c1"><br />&nbsp;<br />&nbsp;</span><span class="c0" style="color: #cc6600;">if</span><span class="c1">&nbsp;(buttonState ==&nbsp;</span><span class="c0" style="color: #cc6600;">true</span><span class="c1">){<br />&nbsp; &nbsp;</span><span class="c0 c2" style="color: #cc6600; font-weight: bold;">Serial</span><span class="c1">.</span><span class="c0" style="color: #cc6600;">println</span><span class="c1">(buttonState);<br />&nbsp;<br />&nbsp; &nbsp;lcd.</span><span class="c0" style="color: #cc6600;">setCursor</span><span class="c1">(0, 1);<br />&nbsp; &nbsp;</span><span class="c0" style="color: #cc6600;">for</span><span class="c1">&nbsp;(</span><span class="c0" style="color: #cc6600;">int</span><span class="c1">&nbsp;i=0; i &lt;= 15; i++) &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// print 16 block characters</span><span class="c1"><br />&nbsp; &nbsp;{<br />&nbsp; &nbsp; &nbsp;lcd.</span><span class="c0" style="color: #cc6600;">print</span><span class="c1">((</span><span class="c0" style="color: #cc6600;">char</span><span class="c1">) 0);<br />&nbsp; &nbsp;}<br />&nbsp; &nbsp;</span><span class="c0" style="color: #cc6600;">delay</span><span class="c1">(100);<br />&nbsp;<br />&nbsp; &nbsp;</span><span class="c0" style="color: #cc6600;">for</span><span class="c1">&nbsp;(</span><span class="c0" style="color: #cc6600;">int</span><span class="c1">&nbsp;i=15; i &gt;= 0; i--) &nbsp;</span></span></p><p class="c4" style="line-height: 1; direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1">&nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// loop through the 16 characters in row</span><span class="c1"><br />&nbsp; &nbsp; &nbsp;</span><span class="c0" style="color: #cc6600;">for</span><span class="c1">&nbsp;(</span><span class="c0" style="color: #cc6600;">int</span><span class="c1">&nbsp;c=0; c &lt;= 5; c++) &nbsp;</span></span></p><p class="c4" style="line-height: 1; direction: ltr; margin: 0px;"><span style="font-family: verdana, geneva; font-size: medium;"><span style="font-family: verdana, geneva;"><span class="c1">&nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// loop through the 5 places that make up a character</span><span class="c1"><br />&nbsp; &nbsp; &nbsp; &nbsp;beeper=!beeper;<br />&nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c0" style="color: #cc6600;">digitalWrite</span><span class="c1">(13, beeper);</span><span class="c1 c3" style="color: #7e7e7e;">// Turn beeper on or off</span><span class="c1"><br />&nbsp; &nbsp; &nbsp; &nbsp;lcd.</span><span class="c0" style="color: #cc6600;">setCursor</span><span class="c1">(i, 1);<br />&nbsp; &nbsp; &nbsp; &nbsp;lcd.</span><span class="c0" style="color: #cc6600;">print</span><span class="c1">((</span><span class="c0" style="color: #cc6600;">char</span><span class="c1">) c); &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// print our custom character</span><span class="c1"><br />&nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c0" style="color: #cc6600;">delay</span><span class="c1">(100); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// the delays add up to about 8 seconds,&nbsp;</span><span class="c1"><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// that's how long the door lock will be open for.</span><span class="c1"><br />&nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp;</span><span class="c0" style="color: #cc6600;">digitalWrite</span><span class="c1">(13, 0); &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// set beeper off</span><span class="c1"><br />&nbsp;} &nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// end if button loop</span><span class="c1"><br />} &nbsp;&nbsp;</span><span class="c1 c3" style="color: #7e7e7e;">// end mail loop&nbsp;</span></span></span><span style="font-family: verdana, geneva; font-size: medium;"><span class="c1"><br /></span></span></p><p class="c4 c12" style="line-height: 1; direction: ltr; height: 11pt; margin: 0px;"></p><p class="c4 c12" style="line-height: 1; direction: ltr; height: 11pt; margin: 0px;"></p></td></tr></tbody></table><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"></p><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"></p><p class="c5 c12" style="direction: ltr; height: 11pt; margin: 0px;"><strong><span style="font-size: large;"><a href="http://www.hobbyist.co.nz/?q=motorised-lock-control" title="Next Step">Next Step: motorised lock control</a></span></strong></p></div>


entity_type: node
bundle: page
language: und
body_format: full_html
body_value:
  <p><span style="font-size: medium;"><b id="internal-source-marker_0.1647293276619166" style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Here, we add the RFID module to what we have put together to date.</span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">The &nbsp;RFID module communicates with its UART serial serial port to the Arduino via the SoftwareSerial library. &nbsp;Also on the RFID module is a signal pin. &nbsp;When a RFID Tag is within range (6cm max) an LED on lights up and the signal pin changes its state. &nbsp;That change of state can be monitored by the arduino and so triggers other actions, like reading the Tag ID. </span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Commands are sent of through the software serial port to the RFID module.</span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">The RFID module supports from 3.3v and 5v and it works at 13.56Mhz.</span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">The integrated reader has a &nbsp;detection distance of up to 6cm at 5v.</span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">The command and response data structure always start with the hex bytes 0xAA 0xBB. The next byte contains the length of the command or data, followed by the bytes of the command or data. &nbsp;The last byte is a CRC checksum of the bytes that make up the length and command or data.</span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">RFID Data Format:</span></b></span></p><div dir="ltr"><table style="border-width: initial; border-color: initial; border-image: initial; border-collapse: collapse; border-style: none;"><colgroup><col width="112" /><col width="131" /><col width="170" /><col width="242" /></colgroup><tbody><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Head </span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Length </span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Command </span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">XOR Checksum</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #1c3387; background-color: #fcfcfc; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">AA BB</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"></span></span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #ad0000; background-color: #fcfcfc; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">01 </span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"></span></span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #de5700; background-color: #fcfcfc; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">01 </span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"></span></span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #328712; background-color: #fcfcfc; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">03</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"></span></span></td></tr></tbody></table></div><p><b id="internal-source-marker_0.1647293276619166" style="font-family: 'Times New Roman'; font-size: medium;"><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">With the RFID Serial port baud rate is set to 19200 a request read Tag command is sent. </span></b></p><p><b id="internal-source-marker_0.1647293276619166" style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Its format in HEX is </span><span style="font-family: Verdana; color: #1c3387; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">AA BB</span><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #ad0000; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">02 </span><span style="font-family: Verdana; color: #de5700; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">20</span><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #328712; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">22</span><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> (5 bytes).</span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">If for some reason there is no Tags within the working area of RFID module, then the RFID module responds with an error code </span><span style="font-family: Verdana; color: #2d4fc9; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">AA BB</span><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #ad0000; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">02</span><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #de5700; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">DF</span><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #328712; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">DD</span><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> (5 bytes). The error code is the inverse of the command requested.</span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">The read command is Hex </span><span style="font-family: Verdana; color: #de5700; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">20</span><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> and its inverse is </span><span style="font-family: Verdana; color: #de5700; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">DF</span><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">, &nbsp;you can see this easier where you look at </span></b><b id="internal-source-marker_0.1647293276619166" style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">the binary &nbsp;</span><span style="font-family: Verdana; color: #de5700; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">00100000 </span><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">inverse is </span><span style="font-family: Verdana; color: #de5700; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap;">11011111</span><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">.</span></b></p><p><span style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">If there is a Tag in range then the RFID module reponds with the Tags ID</span><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">ie: </span><span style="font-family: Verdana; color: #1c3387; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">AA BB</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #ad0000; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">06</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #de5700; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">20</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #6a0081; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">5E 97 25 C7</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #328712; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">0D</span><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> (9 bytes). </span><span style="font-family: Verdana; color: #6a0081; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">5E 97 25 C7</span><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> is the Tag ID.</span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Below are two programs for the Arduino, &nbsp;the first is used to find out what the Tag ID values are and the second uses those Tag ID values to activate the door lock.</span></span></p><p><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span><a href="/sites/default/files/pictures/rfid_lock_control.png"><img src="/sites/default/files/pictures/rfid_lock_control.png" border="0" width="660" height="267" /></a><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Click to see larger Image</span><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span></p><p><br /><span style="font-family: Verdana; background-color: #fcfcfc; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">The 5 wiring for the RFID module:</span></p><div dir="ltr"><table style="border-width: initial; border-color: initial; border-image: initial; border-collapse: collapse; width: 624px; border-style: none;"><colgroup><col width="*" /><col width="*" /></colgroup><tbody><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">RFID Module</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Arduino</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Ground (Black)</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Ground</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">+5v (Red)</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">+5v</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Signal (Yellow)</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Digital Pin 5</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Serial Tx (Blue)</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Digital Pin 3</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Serial Rx (Green)</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: #fcfcfc; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Digital Pin 2</span></td></tr></tbody></table></div><div dir="ltr"></div><div dir="ltr"><span style="font-size: medium; font-family: verdana, geneva;">The code below is used to read the RFID tag IDs, &nbsp;these will be displayed on the LCD and via the serial monitor.</span></div><div dir="ltr"><table style="border-width: initial; border-image: initial; border-collapse: collapse; width: 640px; border-style: none;" border="1"><colgroup><col width="*" /></colgroup><tbody><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; background-color: #fce5cd; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">#include &lt;SoftwareSerial.h&gt;<br class="kix-line-break" />#include &lt;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">LiquidCrystal</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.h&gt;<br class="kix-line-break" /><br class="kix-line-break" />#define rxPin 3<br class="kix-line-break" />#define txPin 2<br class="kix-line-break" />SoftwareSerial RFID(rxPin, txPin); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">//SoftwareSerial(rxPin, txPin)</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// initialize the library with the numbers of the interface pins</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">LiquidCrystal</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> lcd(7, 8, 9, 10, 11, 12);<br class="kix-line-break" /><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">//#define ledPin 13</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// &nbsp;RFID tag present. &nbsp;1 = no &nbsp;0 = yes </span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> tag_there = 1;<br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> reading_tag = 0; &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// prevents multipul reads of the same tag. </span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" /></span></span><span style="font-size: medium;"><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// command to read RFID Tag</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></span><span style="font-size: medium;"><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">unsigned</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">char</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> CMD[] = {0xAA, 0xBB, 0x02, 0x20, 0x22}; &nbsp;&nbsp;</span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;"><br /></span></span></p><span style="font-size: medium;"><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;"> // define array for the response.</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></span><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> response[32]; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><font face="Verdana" color="#7e7e7e"><span style="white-space: pre-wrap;"><br class="kix-line-break" /></span></font></span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">void</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">setup</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">()<br class="kix-line-break" />{<br class="kix-line-break" />&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// set up the LCD's number of columns and rows: </span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(16, 2);<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// Print a message to the LCD.</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">"RFID Reader"</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(19200);<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">"Serial Ready"</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;RFID.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(19200);<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">"RFID Ready"</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(5, </span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">INPUT</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// input from RFID module tag in range.</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" />}<span style="color: #999999;"> // end setup</span><br class="kix-line-break" /><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">//----------------------------------------------------------------------------------</span><span style="vertical-align: baseline;"><font face="Verdana" color="#7e7e7e"><span style="white-space: pre-wrap;"><br class="kix-line-break" /></span></font></span></span><span style="color: #7e7e7e; font-family: verdana, geneva; white-space: pre-wrap; font-size: medium;">// Main Loop</span>&nbsp;</p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">void</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">loop</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">()<br class="kix-line-break" />{<br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">setCursor</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(0, 1);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;tag_there=</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">digitalRead</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(5); &nbsp;<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// &nbsp;Look at RFID card to see if a Tag is in range.</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// 1 = no tag true </span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// 0 = tag found false </span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" /> </span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> (tag_there == 0) {<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">"tag: "</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;reading_tag = 1;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;readTag(response); &nbsp; </span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// read the tag id into response</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[0],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// check response [bytes 0 1] AA BB </span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[1],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[2],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// the size of response [byte 2]</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[3],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// the command [byte 3] </span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> // &nbsp;if this byte is the invert of the command sent then it's a error </span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;"> // (1s complement of the command) - 20 if read or DF if error</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[4],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// start of tag id number -</span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;"> // the data returned, [byte 4] -&gt; [byte 4]+([byte 2] - 1) </span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[5],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[6],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[7],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[8],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[9],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// AABB 2 DF DD0000 0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error reading tag</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// AABB 6 20 <span style="color: #ff0000;">6CD01E54D0</span> 0 &nbsp;tag read (my test tag number)</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><font color="#7e7e7e"> </font></span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><font color="#7e7e7e"></font> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> (response[3]==0x20) &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// was read ok?</span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;"> // if so. loop through the ID number displaying it to the LCD</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;{</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">for</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> rfid_key = 4; rfid_key &lt; (4 + (response[2]-1)); rfid_key++) </span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> { <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(response[rfid_key],</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">HEX</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;}<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="font-family: Verdana; color: #006699; vertical-align: baseline; white-space: pre-wrap;">" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;reading_tag = 0;<br class="kix-line-break" /> &nbsp;}<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(200);<br class="kix-line-break" />}</span></span> <span style="color: #7e7e7e; font-family: verdana, geneva; white-space: pre-wrap; font-size: medium;">// End Main loop</span>&nbsp;<span style="font-size: medium;"><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">//----------------------------------------------------------------------------------</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// send the read command to the RFID care and then read the response</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">void</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> readTag(</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> readdata[32])<br class="kix-line-break" />{<br class="kix-line-break" /> &nbsp;RFID.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">write</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(CMD,5); &nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// &nbsp;{0xAA, 0xBB,0x02, 0x20, 0x22}; &nbsp;</span></span></p><p dir="ltr" style="margin-left: 6pt; margin-right: 6pt; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;"> // send command to read RFID card</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(100); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// wait for it to process</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> index=0;<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">while</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(RFID.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">available</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">() &gt; 0) </span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// read in result</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> Val = RFID.</span><span style="font-family: Verdana; color: #cc6600; vertical-align: baseline; white-space: pre-wrap;">read</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">(); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// read a char</span></span><span style="vertical-align: baseline;"><span style="font-size: medium;"><font face="Verdana"><span style="white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span></font></span><br class="kix-line-break" /><span style="font-size: medium;"><font face="Verdana"><span style="white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;readdata[index] = Val;</span></font></span><br class="kix-line-break" /><span style="font-size: medium;"><font face="Verdana"><span style="white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;index++;</span></font></span><br class="kix-line-break" /><span style="font-size: medium;"><font face="Verdana"><span style="white-space: pre-wrap;"> &nbsp;&nbsp;}</span></font></span><br class="kix-line-break" /><span style="font-size: medium;"><font face="Verdana"><span style="white-space: pre-wrap;">} </span></font></span></span><span style="color: #7e7e7e; font-family: verdana, geneva; font-size: medium; white-space: pre-wrap;">// End read Tag</span></p></td></tr></tbody></table></div><div dir="ltr"></div><div dir="ltr"><div><span style="border-collapse: separate; font-family: Tahoma; border-spacing: 0px; font-size: medium;"><span style="color: #222222; font-family: arial, sans-serif; font-size: 13px;">&nbsp;hint: if the LCD shows only tag, but no ID, the rx and tx may be connected the other way round or the like.</span></span></div></div><p><span style="font-size: medium;">The actually circuit may look something like this</span></p><p><a href="/sites/default/files/pictures/RFID_kit/Step3.1%20%28Medium%29.jpg" title="RFID step3"><img src="/sites/default/files/pictures/RFID_kit/Step3.1%20%28Medium%29.jpg" border="0" alt="RFID step3" title="RFID step3 " width="662" height="497" /></a></p><p></p><p><span style="font-size: medium; font-family: verdana, geneva;">Below is the code use to read and RFID Tag and if it's the right one, will open the lock.</span></p><p><span style="font-size: medium; font-family: verdana, geneva;">Note the line,&nbsp;</span><strong style="background-color: #fce5cd;"><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> theKey[] = {<span style="color: #ff0000;">0x6C,0xD0,0x1E,0x54,0xD0</span>};</span></span></strong></p><p><span style="font-family: verdana, geneva; font-size: medium;">The numbers in red is the RFID Tag ID key that we got from the previous program,</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">you will need to change this to match your RFID Tags ID number.</span></p><div dir="ltr"></div><p></p><div dir="ltr"><table style="border-width: initial; border-image: initial; border-collapse: collapse; width: 640px; border-style: none;" border="1"><colgroup><col width="*" /></colgroup><tbody><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; background-color: #fce5cd; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">#include &lt;SoftwareSerial.h&gt;<br class="kix-line-break" />#include &lt;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LiquidCrystal</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.h&gt;<br class="kix-line-break" /><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// initialize the library with the numbers of the interface pins</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LiquidCrystal</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> lcd(7, 8, 9, 10, 11, 12);<br class="kix-line-break" /><br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch0[8]={B11111,B11111,B11111,B11111,B11111,B11111,B11111,0};<br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch1[8]={B11110,B11110,B11110,B11110,B11110,B11110,B11110,0};<br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch2[8]={B11100,B11100,B11100,B11100,B11100,B11100,B11100,0};<br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch3[8]={B11000,B11000,B11000,B11000,B11000,B11000,B11000,0};<br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch4[8]={B10000,B10000,B10000,B10000,B10000,B10000,B10000,0};<br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch5[8]={B00000,B00000,B00000,B00000,B00000,B00000,B00000,0};<br class="kix-line-break" /><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// setup SoftwareSerial</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" />#define rxPin 3<br class="kix-line-break" />#define txPin 2<br class="kix-line-break" />SoftwareSerial RFID(rxPin, txPin);<br class="kix-line-break" /><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// digital pins the lock uses</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" />#define motor0 4 &nbsp;<br class="kix-line-break" />#define motor1 6<br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> beeper = 0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Beeper flag 0 = off</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" />char c='o';</span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// &nbsp;RFID tag present. &nbsp;1 = no &nbsp;0 = yes </span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> tag_there = 1;<br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> reading_tag = 0; &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// prevents multipul reads of the same tag. </span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <span style="color: #7e7e7e;">// command to read RFID Tag</span> </span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">unsigned</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">char</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> CMD[] = {0xAA, 0xBB, 0x02, 0x20, 0x22}; &nbsp;&nbsp;</span></span></p><p><span style="font-size: medium;"><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> response[32]; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// define array for the response.</span></span></p><p><strong style="font-family: verdana, geneva; font-size: medium;"><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// command to read RFID Tag<br />unsigned char CMD[] = {0xAA, 0xBB, 0x02, 0x20, 0x22}; </span></strong></p><p><strong style="font-family: verdana, geneva; font-size: medium;"><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br /></span></strong></p><p><strong style="font-family: verdana, geneva; font-size: medium;"><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// our rfid key discovered from reader program </span></strong></p><p><strong><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> theKey[] = {<span style="color: #ff0000;">0x6C,0xD0,0x1E,0x54,0xD0</span>}; &nbsp;</span></span></strong></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <br /></span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">void</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">setup</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">()<br class="kix-line-break" />{<br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(16, 2); &nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// set up the LCD's number of columns and rows: </span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"RDFIdoor Control"</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(0, ch0); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// initialise our custom characters</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(1, ch1);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(2, ch2);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(3, ch3);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(4, ch4);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(5, ch5);<br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(19200); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// For Serial debugging, </span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // 19200 baud as that’s the speed the RFID card works at.</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"Serial Ready"</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;RFID.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(19200);<br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"RFID Ready"</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">OUTPUT</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// set lock motor pins to output</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">OUTPUT</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(5, </span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">INPUT</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// input from RFID module tag in range pin.</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13, </span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">OUTPUT</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// door beeper</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(A5, </span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">INPUT</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Button input - using as a digital pin</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" />} </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// end setup</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">//--------------------------------------------------------------------------------------</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Main loop</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">void</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">loop</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">()<br class="kix-line-break" />{<br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">boolean</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> buttonState = </span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalRead</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(A5); </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// get button state</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;buttonState =! buttonState; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Invert button state to match logic</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">boolean</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> rfid_tag_present = </span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalRead</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(5); &nbsp;</span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // test if a rfid tag is present, digitlpin 5)</span></span></p><div dir="ltr" style="display: inline !important;"><table style="border-width: initial; border-color: initial; border-image: initial; border-collapse: collapse; width: 624px; display: inline !important; border-style: none;"><tbody style="display: inline !important;"><tr style="height: 0px; display: inline !important;"><td style="border-image: initial; vertical-align: top; display: inline !important; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p style="display: inline !important;"><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;rfid_tag_present != rfid_tag_present;</span></span></p></td></tr></tbody></table></div><p><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br /></span></p><p><span style="font-size: medium;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (buttonState == </span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">true</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">){</span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><span style="white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;</span></span><span style="color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"Button pressed."</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;openLock();<br class="kix-line-break" /> &nbsp;} </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// if button loop</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (rfid_tag_present == </span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">true</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">)<br class="kix-line-break" /> &nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"RFID tag present."</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// read rfid tag</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;readTag(response); &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// read the tag id into response</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (response[3]==0x20) &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// was read ok,</span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // if so. loop through the ID number displaying it to the LCD</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> key_Invalid = 0;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> the_rfid_key = 0; the_rfid_key &lt; ((response[2]-1)); the_rfid_key++) { <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (theKey[the_rfid_key] != response[the_rfid_key+4]) {key_Invalid++;} &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// if wrong, key_Invalid is not zero</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">if</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (key_Invalid == 0)<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;openLock();<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">else</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"Key Invalid"</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;} &nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;<br class="kix-line-break" />} </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// end loop</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br /></span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">//-----------------------------------------------------------------------------------</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">//void readTag(unsigned char readdata[32])</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">void</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> readTag(</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> readdata[32])<br class="kix-line-break" />{<br class="kix-line-break" /> &nbsp;RFID.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">write</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(CMD,5); &nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// {0xAA, 0xBB,0x02, 0x20, 0x22}; &nbsp;</span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // send command to read RFID card</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(100); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// wait for it to process</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> index=0;<br class="kix-line-break" /> &nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">while</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(RFID.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">available</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">() &gt; 0) </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// read in result</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> Val = RFID.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">read</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(); &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// read a char</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;readdata[index] = Val;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;index++;<br class="kix-line-break" /> &nbsp;&nbsp;} <br class="kix-line-break" />} <br class="kix-line-break" /></span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">//-----------------------------------------------------------------------------------</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">void</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> openLock()<br class="kix-line-break" />{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Open lock</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">HIGH</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(500); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Length of time for lock to fully opening</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Stop motor</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">setCursor</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(0, 1);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> i=0; i &lt;= 15; i++) </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// print 16 block characters</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">((</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">char</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">) 0);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(100);<br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> i=15; i &gt;= 0; i--) &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// loop through the 16 characters</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;{</span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: medium; font-family: verdana, geneva;"><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// </span></span><span style="white-space: normal; color: #7e7e7e; font-size: 16px; line-height: 16px; text-align: left;">&nbsp;</span><span style="white-space: normal; color: #7e7e7e; font-size: 16px; line-height: 16px; text-align: left;">loop through the 5 colums that make up a character</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> c=0; c &lt;= 5; c++) </span></span></p><p><span style="font-size: medium; font-family: verdana, geneva;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beeper=!beeper;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13, beeper);</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Turn beeper on or off</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">setCursor</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(i, 1);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">((</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">char</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">) c); </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// print our custom character</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(100); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// the delays add up to about 8 seconds, </span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// that's how long the door lock will be open for.</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13, 0); &nbsp;&nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// set beeper off</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">HIGH</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Close Lock motor </span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(500);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Stop lock motor</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" />} </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// End Open Lock</span></span></p><p></p></td></tr></tbody></table></div><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Ending notes:</span><br /><font size="3"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"></span></font><br /><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Above is a basic look at working with RFID module but is can do so much more and so here is a collection of notes that I collected when developing this project. Have a look at <a href="/sites/default/files/pictures/rfid%20YHY502CTG_en_almost_alike.pdf" title="PDF document">this PDF</a> if you would like to know more about working with the RDIF reader/writer.</span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Pin Definitions of RFID card module:</span></b></p><div dir="ltr"><table style="border-width: initial; border-color: initial; border-image: initial; border-collapse: collapse; border-style: none;"><colgroup><col width="67" /><col width="96" /><col width="104" /><col width="198" /><col width="275" /></colgroup><tbody><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Pin</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Symbol</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">IO Type</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Description</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Arduino</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> or </span><span style="font-family: Verdana; color: #41007d; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">notes</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"></span></span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">J1-1</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #e30000; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">RXD</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">I/O</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Uart Receiver</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">serial link to arduino pin 2</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">J1-2</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #e30000; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">TXD</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">I/O</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Uart Transmitter</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">serial link to arduino pin 3</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">J1-3</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">OUT1</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">I/O</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Output 1</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"></span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">J1-4</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">OUT2</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">I</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Output 2</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"></span></td></tr><tr style="height: 76px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">J1-5</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">RST</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">I</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Reset, active-low </span><br /><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">floating for power-on reset by default</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"></span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">J1-6</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">BUZ</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">I</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Buzzer output, high level drive</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-size: medium;"><span style="font-family: Verdana; color: #41007d; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Could be for different model</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"></span></span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">J1-7</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #e30000; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">SIG</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">O</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Interrupt output,</span><br /><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">LOW level indicates card in the field</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">arduino digital pin 5</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> J1-8</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #e30000; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">VCC</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Power</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Power Positive</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">to 5v [3v3 can be used but has a smaller field range]</span></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> J1-9</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #e30000; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">GND</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">GND</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; color: #010101; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Power Negative</span></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">to gnd &nbsp;</span></td></tr></tbody></table></div><div dir="ltr"></div><div dir="ltr"><a href="http://www.hobbyist.co.nz/?q=motorised-lock-control" title="Previous Step"><span style="font-size: medium; font-family: verdana, geneva;">&lt; Previous Step</span></a></div>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p></p><p></p><p>This is a low cost motor controller. Although it's not an Arduino Shield, it can be used with Arduino or any other microcontroller platforms. This module allows you to connect 2 DC motors and have total control of them from the arduino. It also can be used to control one 4-wire stepper motor. Due to its high current rating, it's perfect for a single channel heavy duty stepper motor controller.<br /> <br /> It allows you to move each DC motor<br /> - Clockwise<br /> - AntiClockwise<br /> - Stall<br /> - Control motor speed<br /> <br /> A 4-way stripped wire is included.<br /> <br /> This motor controller uses a L298 H-bridge IC<br /> deliveries output current up to 2 A each channel. The speed control is achieved through conventional PWM which can be obtained from Arduinos PWM output Pin 5, 6, 9 and 10.<br /> <br /> Specs:<br /> Peak Output Current (each Channel)<br /> - Non Repetitive (t = 100 ms): 3 A<br /> -Repetitive (80% on -20% off; ton = 10 ms): 2.5 A<br /> -DC Operation: 2 A<br /> Analog voltage input: &nbsp;<br /> Vcc input:<br /> 7 - 35 V with jumper J3 short circuit, which gets regulated to 5 V and it's available on the +5 V terminal.<br /> 5 - 35 V with jumper J3 open circuit, a seperate 5 V input is needed to the +5 V terminal.<br /> Digital voltage input: VD = 5 V (7 V max), this is output 5 V when jumper J3 is short circuit, and input 5 V when J3 is open circuit.<br /> Max power dissipation: 20 W<br /> <br /> There is a voltage regulator that regulates the Vcc to 5 V for digital use.</p><p></p><p>For more detail, please see <a href="http://www.hobbyist.co.nz/?q=how-to-use-l298-motor-controller">How to use L298 motor controller</a>.</p>


entity_type: node
bundle: page
language: und
body_format: full_html
body_value:
  <p style="text-align: left;"><span style="font-size: medium;"><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></span></p><p style="text-align: left;"><span style="font-size: medium;"><b id="internal-source-marker_0.8272735942155123" style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> The Lock control is handled by a <a href="http://www.hobbyist.co.nz/?q=motor-controller-l298" target="_blank" title="L298 Motor Controller">motor controller</a>. &nbsp;This builds on what we have built so far, &nbsp;the button press now opens the lock. Then does the count down and closes the lock.</span><br /> <span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;</span><br /> <span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"> Arduino sends instructions to the motor controller via the Arduinos Digital pins 4 and 6 to the Motor controllers pins In3 and In4.</span><br /></b></span></p><div dir="ltr" style="text-align: center;"><table style="border-image: initial; border-collapse: collapse; border-style: none;" align="center"><colgroup> <col width="317" /> <col width="304" /></colgroup><tbody><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> D4 D6 to left to pins of <span style="background-color: #0000ff;"><span style="color: #ff9900;">In3</span> <span style="color: #ffff00;">In4</span></span></span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> Action</span></p></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"><strong><span style="background-color: #0000ff;"><span style="color: #ff9900;">1</span><span style="color: #ffff00;">0</span></span></strong> (HIGH,LOW)</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> Motor turns clockwise</span></p></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"><strong><span style="background-color: #0000ff;"><span style="color: #ff9900;">0</span><span style="color: #ffff00;">1</span></span></strong> (LOW,HIGH)</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> Motor turns anticlockwise</span></p></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"><strong><span style="background-color: #0000ff;"><span style="color: #ff9900;">1</span><span style="color: #ffff00;">1</span></span></strong> (HIGH,HIGH)</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> Motor breaks</span></p></td></tr><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"><strong><span style="background-color: #0000ff;"><span style="color: #ff9900;">0</span><span style="color: #ffff00;">0</span></span></strong> (LOW,LOW)</span></p></td><td style="border-image: initial; vertical-align: top; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><p dir="ltr" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> Motor is free</span></p></td></tr></tbody></table></div><p style="text-align: center;"><b style="font-family: 'Times New Roman'; font-size: medium;"><br /></b></p><ul style="margin-top: 0pt; margin-bottom: 0pt;"><li style="list-style-type: disc; font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium; font-family: verdana, geneva;"> Arduino connects its 5v to motor controller +5V and the Ground to Ground. &nbsp;</span></li><li style="list-style-type: disc; font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium; font-family: verdana, geneva;"> The Lock Connector contains the power to drive the lock, it’s Ground line also connects to the Motor Controllers Ground. &nbsp;The Locks Power line connects to the Motor Controllers +Vcc.</span></li><li style="list-style-type: disc; font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline;"><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap; font-size: medium; font-family: verdana, geneva;"> The next two pins are the Locks motor and these connect to the Motor Controller pins Out0 and Out 1.</span></li></ul><p><b style="font-family: 'Times New Roman'; font-size: medium;"><br /> <span style="background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium; font-family: verdana, geneva;"> There is also two more pins on the Lock connection.</span><br /> <span style="background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium; font-family: verdana, geneva;"> A Mont pin, that is 0v when the locks latch is closed and +v when the locks latch is open. &nbsp;I currently don’t test this. &nbsp;</span><br /> <span style="background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium; font-family: verdana, geneva;"> The last pin is to a Setter switch, it’s like a reset button this is on the lock and does something with original controller but I don’t use it. &nbsp;It reports 0v when no pushed and +V when pressed.</span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><a href="/sites/default/files/pictures/rfid_motorbuttonbuzzer.jpg" title="Click to see larger Image"><img src="/sites/default/files/pictures/rfid_motorbuttonbuzzer.jpg" border="0" alt="wiring diagram" width="600" height="625" /></a><br /><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="color: #333333; font-size: 12px; line-height: 15px; background-color: #fcfcfc;">Click to see larger Image</span></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="color: #333333; font-size: 12px; line-height: 15px; background-color: #fcfcfc;"><br /></span></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"> <span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">Above you can see the wiring needed to connect the lock</span></b><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> motor.</span><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> The actual circuit may look something like this.</span></p><p><span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"></span><a href="/sites/default/files/pictures/RFID_kit/Step2_motorLock%20%28Medium%29.jpg" title="RFID step2"><img src="/sites/default/files/pictures/RFID_kit/Step2_motorLock%20%28Medium%29.jpg" border="0" alt="RFID step2" title="RFID step2" width="624" height="467" /></a><br /><b style="font-family: 'Times New Roman'; font-size: medium;"> <br /> <span style="font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap; font-size: medium;">There are two bits of code added to control the lock when the button is pressed.</span><br /> <br /> <span style="font-family: Verdana; background-color: transparent; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> Below opens the lock.</span><br /> <span style="font-size: medium;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Open lock</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">HIGH</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(500); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Time for lock to open fully</span> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Stop motor</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);</span></span><br /> <br /> <span style="font-family: Verdana; background-color: transparent; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; font-size: medium;"> Below closes the lock.</span><br /> <span style="font-size: medium;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">HIGH</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Close Lock motor</span> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(500);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Stop lock motor</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);</span></span></b></p><table style="border-style: none; font-family: Verdana,Arial,Helvetica,sans-serif; border-collapse: collapse; width: 652px; height: 1525px;" align="left"><colgroup><col width="*" /></colgroup><tbody><tr style="height: 0px;"><td style="border-image: initial; vertical-align: top; background-color: #fff2cc; border-width: 1px; border-color: #aaaaaa; border-style: dotted; padding: 7px;"><span style="font-size: medium;"><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> #include &lt;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LiquidCrystal</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.h&gt;<br class="kix-line-break" /> <br class="kix-line-break" /> #define motor0 4 &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// digital pins the lock uses</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> #define motor1 6<br class="kix-line-break" /> <br class="kix-line-break" /></span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// initialize the library with the numbers of the interface pins</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">LiquidCrystal</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> lcd(7, 8, 9, 10, 11, 12);<br class="kix-line-break" /> <br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch0[8] = {B11111,B11111,B11111,B11111,B11111,B11111,B11111,0};<br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch1[8] = {B11110,B11110,B11110,B11110,B11110,B11110,B11110,0};<br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch2[8] = {B11100,B11100,B11100,B11100,B11100,B11100,B11100,0};<br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch3[8] = {B11000,B11000,B11000,B11000,B11000,B11000,B11000,0};<br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch4[8] = {B10000,B10000,B10000,B10000,B10000,B10000,B10000,0};<br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">byte</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> ch5[8] = {B00000,B00000,B00000,B00000,B00000,B00000,B00000,0};<br class="kix-line-break" /> <br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> beeper = 0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Beeper flag 0 = off</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> <br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">void</span>&nbsp;<span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> setup</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">()<br class="kix-line-break" /> {<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13,</span>&nbsp;<span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> OUTPUT</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// door beeper</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(A5,</span>&nbsp;<span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> INPUT</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Button input - we are using as a digital pin</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> <br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">OUTPUT</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // set lock motor pins to output</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">pinMode</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">OUTPUT</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> <br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(16, 2); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// set up the LCD's number of columns and rows:</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"Lock test"</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">);</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // Print startup message to the LCD.</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> <br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">begin</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(19200); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// For Serial debugging, 19200 baud because</span></span><br /><span style="font-size: medium;"><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="font-family: Verdana; color: #006699; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">"Ready"</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">); </span>&nbsp;&nbsp; &nbsp;// that’s the speed the RFID card works at.</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;<br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(0, ch0); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// initialise our custom characters</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(1, ch1);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(2, ch2);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(3, ch3);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(4, ch4);<br class="kix-line-break" /> &nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">createChar</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(5, ch5);<br class="kix-line-break" /> }</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // end setup</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> <br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">void</span>&nbsp;<span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> loop</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">()<br class="kix-line-break" /> {<br class="kix-line-break" /></span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> boolean</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> buttonState =</span>&nbsp;<span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> digitalRead</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(A5);</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // get button state</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> buttonState =! buttonState; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// Invert button state to match logic</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">if</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (buttonState ==</span>&nbsp;<span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> true</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">){<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Serial</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">println</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(buttonState);<br class="kix-line-break" /> <br class="kix-line-break" /></span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">// Open lock</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">HIGH</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(500); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> // time for lock to open fully</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">// Stop motor</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">);</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">setCursor</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(0, 1);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> i=0; i &lt;= 15; i++) &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// print 16 block characters</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;{<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">((</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">char</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">) 0);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(100);<br class="kix-line-break" /> &nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> i=15; i &gt;= 0; i--) &nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // loop through the 16 characters</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">int</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> c=0; c &lt;= 5; c++) &nbsp;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// loop through the 16 characters places of the LCD screen</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beeper=!beeper;<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13, beeper);</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // Turn beeper on or off</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">setCursor</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(i, 1);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lcd.</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">((</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">char</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">) c); &nbsp;&nbsp; &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// print our custom character</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(100); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // the delays add up to about 8 seconds,</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // that's how long the door lock will be open for.</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;} &nbsp;</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // end count down loop</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13, 0); &nbsp;&nbsp;</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // set beeper off</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> <br class="kix-line-break" /></span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">HIGH</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">// Close Lock motor</span>&nbsp;<span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">delay</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(500);<br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor0,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">); &nbsp;</span><span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">// Stop lock motor</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> &nbsp;&nbsp;&nbsp;</span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">(motor1,</span><span style="font-family: Verdana; color: #006699; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">LOW</span><span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">);</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> <br class="kix-line-break" /> &nbsp;}</span>&nbsp;<span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // end if button loop</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /> }</span></span>&nbsp;<span style="font-size: 19px; font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <span style="font-size: medium;">// end main loop</span></span>&nbsp;<span style="font-size: 19px; font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span></td></tr></tbody></table><p></p><p></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><p><b style="font-family: 'Times New Roman'; font-size: medium;"><span style="font-size: 19px; font-family: Verdana; background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><br /></span></b></p><div><span style="border-collapse: separate; border-spacing: 0px; font-size: large;"><a href="http://www.hobbyist.co.nz/?q=rfid-lcd-interface" title="First Step">&lt; Previous Step</a> &nbsp;| <a href="http://www.hobbyist.co.nz/?q=rfid-door-lock-controller" title="Final step">Next Step &gt;</a></span></div><div><span style="border-collapse: separate; border-spacing: 0px; font-size: large;"><br /></span></div><div><span style="border-collapse: separate; border-spacing: 0px; font-size: large;"><br /></span></div><div><span style="border-collapse: separate; border-spacing: 0px; font-size: large;"><br /></span></div>


entity_type: node
bundle: product
language: und
body_format: full_html
body_value:
  <p><span style="font-size: medium;"><img src="/sites/default/files/pictures/ServoController/ServoController_cable_small.jpg" border="0" alt="USB Servo controller 16 channels" title="USB Servo controller 16 channels" width="486" height="324" /></span></p><p><span style="font-size: medium;">This is a 16-channel: mini-USB servo controller. </span><br /> <br /><span style="font-size: medium;">A mini-USB cable is included</span></p><p><span style="font-size: medium;">Ideal for 6 legged robots or similar.</span><br /> <br /><span style="font-size: medium;">It uses a 32-bit processor, fast response and stable operation. USB interface, can be directly interfaced to a pc. Self-detect Baud-rate (9600, 19200, 38400, 57600, 115200, 128000) </span><br /> <br /><span style="font-size: medium;">Example </span><br /><span style="font-size: medium;">Serial.begin(115200); // Set baud-rate to be 115200 </span><br /><span style="font-size: medium;">Serial.print("#1P1200T1000\r\n"&shy;); // Turn channel 1 on at 1200 position for 1000ms. <br /></span><span style="font-size: medium;">Serial.print("#1P1200T1000#2P1600T1000\r\n"&shy;); // Turn chanenl 1 and 2 simultaneously</span></p><p><span style="font-size: medium;">This is the <a href="http://www.hobbyist.co.nz/?q=how-to-use-mini-usb-servo-controller">tutorial</a> to show how to use this servo controller.<br /></span></p>


entity_type: node
bundle: article
language: und
body_format: full_html
body_value:
  <h2><span style="font-size: large;">This tutorial details how to use the mini USB servo controller in Windows 7.</span></h2><p></p><p><span style="font-size: medium;">1. Plug the mini USB to the computer, and the two LEDs (ON, LED) should turn on, green and red.</span></p><p><span style="font-size: medium;"><img src="data:image/jpeg;base64,[encoded data, 58036 characters]" border="0" alt="" width="432" height="111" /></span></p><p></p><p><span style="font-size: medium;">2. Once the USB is plugged to a Windows 7 PC, the driver should be automatically installed. Confirm the COM port the servo controller is connected to in device manager. To go to device manager, press the start button, right click on 'computer', and select 'properties'. Then choose 'Device Manager' on the top left corner.</span></p><p><span style="font-size: medium;"><img src="data:image/jpeg;base64,[encoded data, 111688 characters]" border="0" alt="" width="566" height="407" /></span></p><p><br /><span style="font-size: medium;"> 2, it should be noted that the usb doesn't supply any power to the servo, since there are potentially 16 servos, usb has no way of supply sufficient current for that. So an external power source has to connect to the 5v and gnd screw terminals. It doesn't have to be 5v, you can connect whatever voltage you like to supply to the servos, they normally tolerate up to 6v. With the power supply, the 3rd LED will turn on.</span></p><p><span style="font-size: medium;"><img src="data:image/jpeg;base64,[encoded data, 121852 characters]" border="0" alt="" width="513" height="224" /></span></p><p><span style="font-size: medium;">3. plug in servos, brown is GND, and orange is Signal.</span></p><p><span style="font-size: medium;"><img src="data:image/png;base64,[encoded data, 46800 characters]" border="0" alt="" width="348" height="281" /></span></p><p><br /><img src="data:image/jpeg;base64,[encoded data, 93156 characters]" border="0" alt="" width="572" height="330" /></p><p><span style="font-size: medium;">4, send command from pc. Terminal programs like putty is great if you want to send each character separately as you type on the keyboard, but for the servo controller you better use a terminal program that can send a whole string when you press a button. For example, you can use the <a href="http://arduino.googlecode.com/files/arduino-1.0.1-windows.zip">Arduino program</a>, open it and select the correct COM from tools-&gt; Serial port</span></p><p><span style="font-size: medium;"><img src="data:image/png;base64,[encoded data, 104120 characters]" border="0" alt="" width="633" height="563" /></span></p><p><span style="font-size: medium;">5, open on the serial monitor on the top right corner. On the bottom of the serial monitor, the baudrate doesn't matter, but change the 'no line ending' to both 'NL &amp; CR'.</span></p><p><span style="font-size: medium;"><img src="data:image/png;base64,[encoded data, 41996 characters]" border="0" alt="" width="511" height="418" /></span><br /><span style="font-size: medium;"> 6, in the serial monitor, you can type command, for example, type #1P1200T1000 and hit 'send button' will it send a 1200 us duty cycle PWM to channel 1 for 1000 ms. If you like to control 2 servos simultaneously, use the command <br /> <br /> #1P1200T1000#2P1200T1000<br /> <br /> Please note that normally the servo range is from 1000us (+90 degree) to 2000us (-90 degree), with 1500us being the neutral position. <br /> </span></p>


