# cache_field

cid: field:node:96
data:
  a:1:{s:4:"body";a:1:{s:3:"und";a:1:{i:0;a:5:{s:5:"value";s:10340:"<pre><span style="text-decoration: underline;"><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong>Finding your PC's ip address</strong></span></span></pre><div><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">To get your browser to talk to the Arduino<strong></strong> its important that both share the same ip subnet.</span></div><div><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So the next step is to find your computers ip address. The following links should help you with it.</span></div><p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><br /></strong></span></p><p><br /><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong src="/sites/default/files/NetSensor/windowslogo.jpg" border="0" height="85" width="113">&nbsp;<img src="/sites/default/files/NetSensor/windows_logo.jpg" border="0" width="82" height="59" />Windows, Mac users:</strong></span><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong></strong></span></p><div style="text-align: left;"><span style="font-size: medium;"><strong></strong></span><span style="font-size: medium;"><a href="http://www.stolaf.edu/services/iit/documentation/ipaddress.html" target="_blank" title="How to find ip address on Windows PC">http://www.stolaf.edu/services/iit/documentation/ipaddress.html</a></span><span style="font-size: medium;"></span></div><p><br /><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong></strong></span></p><p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><img src="/sites/default/files/NetSensor/linux.jpg" border="0" width="78" height="57" /> Linux users:</strong></span></p><p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Type the following command on the command prompt</span></p><p style="padding-left: 30px;"><span style="font-size: medium; color: #003366;">&gt; ifconfig eth0</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: medium; color: #003366;">eth0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link encap:Ethernet&nbsp; HWaddr bc:ae:c5:49:b1:ee&nbsp; </span><br /><span style="font-family: courier new,courier; font-size: medium; color: #003366;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet addr:<strong>192.168.20.200</strong>&nbsp; Bcast:192.168.20.255&nbsp; Mask:255.255.255.0</span><br /><span style="font-family: courier new,courier; font-size: medium; color: #003366;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet6 addr: fe80::beae:c5ff:fe49:b1ee/64 Scope:Link</span><br /><br /></p><pre><br /><span style="text-decoration: underline;"><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><strong>What to do once you got your ip ?</strong></span></span></pre><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">Once you have your ip, lets say its <strong>192.168.1.20</strong>. The next step is to pick an ip address in the same subnet for the Arduino so that the PC can talk to the Arduino.</span></div><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">For simplicity sake, just increment the last digits of the ip address by 1 and use that ip address for the Arduino.</span></div><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">In the example case, if your ip as 192.168.1.20, then we would use <strong>192.168.1.21</strong> for the Arduino.</span></div><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><br /></span></div><p><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><em>NOTE: This should work in most cases, only case where this wont is when there is another host on the network with the same ip as the arduino. If that happens pick another ip say x.x.x.23</em></span></p><p></p><p><span style="text-decoration: underline;"><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><strong>Now you have the ip address for the Arduino, how do you program it in ?</strong></span></span></p><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">In file <a href="https://bitbucket.org/sachins/netsensor/src/335f885b4f38b66aa829cc9a204145c6bb1d7490/DHT11_JSON/DHT11_JSON.ino?at=master">DHT11_JSON.ino</a> you will find the following snippet of code which has a comment "Enter your chosen IP here", Go ahead and write the derived Arduino IP address there.</span></div><pre style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small; color: #003366;"><br /> <strong>IPAddress ip(192,168,20,8); // &lt;&lt;&lt;&lt; Enter your chosen IP here</strong></span></pre><p><span style="font-size: medium;">After the above changes compile, upload the code to the Arduino.</span></p><p><span style="font-size: medium;"><br /></span></p><p><span style="font-size: medium;">Connecting the ethernet port of the arduino to the network, there are 2 ways to go about it.</span></p><ul><li><span style="font-size: medium;">Connect Arduino to PC's ethernet port</span></li></ul><p style="padding-left: 30px;"><br /><span style="font-size: medium;"><img src="/sites/default/files/NetSensor/ethernet2Pc.jpg" border="0" title="Ethernet cable to PC" width="320" height="281" /></span></p><p><span style="font-size: medium;"><br /></span></p><ul><li><span style="font-size: medium;">Connect to the LAN port of your wireless router ( preferred option )<br /></span></li></ul><p><span style="font-size: medium;"><img src="/sites/default/files/NetSensor/router.jpg" border="0" title="Router" width="362" height="279" />&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; or&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /></span></p><p></p><p><span style="text-decoration: underline;"><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><br /></strong></span></span></p><pre><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><img src="/sites/default/files/NetSensor/network-cable.jpg" border="0" title="NetworkCable" width="77" height="58" /></strong></span><span style="text-decoration: underline;"><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong>Test if the PC can talk to the Arduino </strong></span></span></pre><div><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">The simplest way to test the connection is to <a href="http://www.orcon.net.nz/support/gfaq_page/how_to_do_a_ping_test_on_windows_7_and_vista" target="_blank" title="How to ping">ping</a> the arduino</span></div><div><span style="font-size: medium;">This can be done using the following command in the command prompt :</span></div><p style="padding-left: 30px;"><span style="font-size: medium; font-family: courier new,courier; color: #003366;">&gt; ping 192.168.1.21</span></p><p><span style="font-size: medium;">If you get a response like this, it means all is well and you can proceed to the next phase:</span></p><p style="padding-left: 30px;"><span style="font-size: medium; font-family: courier new,courier; color: #003300;">PING 192.168.20.21 (192.168.20.21) 56(84) bytes of data.</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">64 bytes from 192.168.20.21: icmp_req=1 ttl=128 time=0.519 ms</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">......</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">64 bytes from 192.168.20.21: icmp_req=4 ttl=128 time=0.098 ms</span><br /><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">--- 192.168.20.21 ping statistics ---</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;"><strong>4 packets transmitted, 4 received, 0% packet loss, time 2999ms</strong></span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">rtt min/avg/max/mdev = 0.083/0.201/0.519/0.183 ms</span><br /><br /></p><pre><span style="text-decoration: underline; font-family: arial,helvetica,sans-serif;"><span style="font-size: medium;"><strong>NetSensor Up and Running....</strong></span></span></pre><div><span style="font-size: medium;">Now is the final moment to see all the pieces come together and you get to see your kit live on the intenet.<strong><br /></strong></span></div><div></div><div><span style="font-size: medium;">To see the kit live, click the following link ( preferably in firefox browser for best results),</span></div><div><span style="font-size: medium;">then feed in the Arduino's ip address:</span></div><div><span style="font-size: medium;"><br /></span></div><p><span style="font-size: medium;"><a href="http://www.hobbyist.co.nz/sites/default/files/NetSensor/javascript/netSensorLive.html" target="NetSensorLive" title="NetSensor Live" id="NetSensorLive">NetSensor Live</a></span></p><p><span style="font-size: medium;"><br /></span></p><pre><span style="text-decoration: underline; font-family: arial,helvetica,sans-serif;"><span style="font-size: medium;"><strong>Playing with the NetSensor</strong></span></span></pre><ul><li><span style="font-size: medium;">&nbsp;Click the bump sensor and see the alarms go off </span></li><li><span style="font-size: medium;">&nbsp;Breathe into the DHT sensor and see the effect on the humidity and temperature readings</span><span style="font-size: medium;"><strong></strong></span><br /><br /></li></ul><p><span style="font-size: medium;"><strong>More things to do..</strong><br /></span></p><div><span style="font-size: medium;">Can you interface this <a href="http://www.hobbyist.co.nz/?q=ultrasonic-sensor-8m">motion sensor</a> into this kit ? </span></div><div><span style="font-size: medium;">If yes, please let us know and send us the results in a video, the best implementation would grab a cool gift from Hobbyist.<br /></span></div>";s:7:"summary";s:0:"";s:6:"format";s:9:"full_html";s:10:"safe_value";s:10039:"<pre><span style="text-decoration: underline;"><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong>Finding your PC's ip address</strong></span></span></pre><div><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">To get your browser to talk to the Arduino<strong></strong> its important that both share the same ip subnet.</span></div><div><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So the next step is to find your computers ip address. The following links should help you with it.</span></div><p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><br /></strong></span></p><p><br /><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong src="/sites/default/files/NetSensor/windowslogo.jpg" border="0" height="85" width="113"> <img src="/sites/default/files/NetSensor/windows_logo.jpg" border="0" width="82" height="59" />Windows, Mac users:</strong></span><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong></strong></span></p><div style="text-align: left;"><span style="font-size: medium;"><strong></strong></span><span style="font-size: medium;"><a href="http://www.stolaf.edu/services/iit/documentation/ipaddress.html" target="_blank" title="How to find ip address on Windows PC">http://www.stolaf.edu/services/iit/documentation/ipaddress.html</a></span><span style="font-size: medium;"></span></div><p><br /><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong></strong></span></p><p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><img src="/sites/default/files/NetSensor/linux.jpg" border="0" width="78" height="57" /> Linux users:</strong></span></p><p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Type the following command on the command prompt</span></p><p style="padding-left: 30px;"><span style="font-size: medium; color: #003366;">&gt; ifconfig eth0</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: medium; color: #003366;">eth0      Link encap:Ethernet  HWaddr bc:ae:c5:49:b1:ee  </span><br /><span style="font-family: courier new,courier; font-size: medium; color: #003366;">          inet addr:<strong>192.168.20.200</strong>  Bcast:192.168.20.255  Mask:255.255.255.0</span><br /><span style="font-family: courier new,courier; font-size: medium; color: #003366;">          inet6 addr: fe80::beae:c5ff:fe49:b1ee/64 Scope:Link</span><br /><br /></p><pre><br /><span style="text-decoration: underline;"><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><strong>What to do once you got your ip ?</strong></span></span></pre><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">Once you have your ip, lets say its <strong>192.168.1.20</strong>. The next step is to pick an ip address in the same subnet for the Arduino so that the PC can talk to the Arduino.</span></div><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">For simplicity sake, just increment the last digits of the ip address by 1 and use that ip address for the Arduino.</span></div><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">In the example case, if your ip as 192.168.1.20, then we would use <strong>192.168.1.21</strong> for the Arduino.</span></div><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><br /></span></div><p><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><em>NOTE: This should work in most cases, only case where this wont is when there is another host on the network with the same ip as the arduino. If that happens pick another ip say x.x.x.23</em></span></p><p></p><p><span style="text-decoration: underline;"><span style="font-size: medium; font-family: arial,helvetica,sans-serif;"><strong>Now you have the ip address for the Arduino, how do you program it in ?</strong></span></span></p><div><span style="font-size: medium; font-family: arial,helvetica,sans-serif;">In file <a href="https://bitbucket.org/sachins/netsensor/src/335f885b4f38b66aa829cc9a204145c6bb1d7490/DHT11_JSON/DHT11_JSON.ino?at=master">DHT11_JSON.ino</a> you will find the following snippet of code which has a comment "Enter your chosen IP here", Go ahead and write the derived Arduino IP address there.</span></div><pre style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small; color: #003366;"><br /><strong>IPAddress ip(192,168,20,8); // &lt;&lt;&lt;&lt; Enter your chosen IP here</strong></span></pre><p><span style="font-size: medium;">After the above changes compile, upload the code to the Arduino.</span></p><p><span style="font-size: medium;"><br /></span></p><p><span style="font-size: medium;">Connecting the ethernet port of the arduino to the network, there are 2 ways to go about it.</span></p><ul><li><span style="font-size: medium;">Connect Arduino to PC's ethernet port</span></li></ul><p style="padding-left: 30px;"><br /><span style="font-size: medium;"><img src="/sites/default/files/NetSensor/ethernet2Pc.jpg" border="0" title="Ethernet cable to PC" width="320" height="281" /></span></p><p><span style="font-size: medium;"><br /></span></p><ul><li><span style="font-size: medium;">Connect to the LAN port of your wireless router ( preferred option )<br /></span></li></ul><p><span style="font-size: medium;"><img src="/sites/default/files/NetSensor/router.jpg" border="0" title="Router" width="362" height="279" />                                                   or                                      <br /></span></p><p></p><p><span style="text-decoration: underline;"><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><br /></strong></span></span></p><pre><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong><img src="/sites/default/files/NetSensor/network-cable.jpg" border="0" title="NetworkCable" width="77" height="58" /></strong></span><span style="text-decoration: underline;"><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><strong>Test if the PC can talk to the Arduino </strong></span></span></pre><div><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">The simplest way to test the connection is to <a href="http://www.orcon.net.nz/support/gfaq_page/how_to_do_a_ping_test_on_windows_7_and_vista" target="_blank" title="How to ping">ping</a> the arduino</span></div><div><span style="font-size: medium;">This can be done using the following command in the command prompt :</span></div><p style="padding-left: 30px;"><span style="font-size: medium; font-family: courier new,courier; color: #003366;">&gt; ping 192.168.1.21</span></p><p><span style="font-size: medium;">If you get a response like this, it means all is well and you can proceed to the next phase:</span></p><p style="padding-left: 30px;"><span style="font-size: medium; font-family: courier new,courier; color: #003300;">PING 192.168.20.21 (192.168.20.21) 56(84) bytes of data.</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">64 bytes from 192.168.20.21: icmp_req=1 ttl=128 time=0.519 ms</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">......</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">64 bytes from 192.168.20.21: icmp_req=4 ttl=128 time=0.098 ms</span><br /><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">--- 192.168.20.21 ping statistics ---</span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;"><strong>4 packets transmitted, 4 received, 0% packet loss, time 2999ms</strong></span><br /><span style="font-size: medium; font-family: courier new,courier; color: #003300;">rtt min/avg/max/mdev = 0.083/0.201/0.519/0.183 ms</span><br /><br /></p><pre><span style="text-decoration: underline; font-family: arial,helvetica,sans-serif;"><span style="font-size: medium;"><strong>NetSensor Up and Running....</strong></span></span></pre><div><span style="font-size: medium;">Now is the final moment to see all the pieces come together and you get to see your kit live on the intenet.<strong><br /></strong></span></div><div></div><div><span style="font-size: medium;">To see the kit live, click the following link ( preferably in firefox browser for best results),</span></div><div><span style="font-size: medium;">then feed in the Arduino's ip address:</span></div><div><span style="font-size: medium;"><br /></span></div><p><span style="font-size: medium;"><a href="http://www.hobbyist.co.nz/sites/default/files/NetSensor/javascript/netSensorLive.html" target="NetSensorLive" title="NetSensor Live" id="NetSensorLive">NetSensor Live</a></span></p><p><span style="font-size: medium;"><br /></span></p><pre><span style="text-decoration: underline; font-family: arial,helvetica,sans-serif;"><span style="font-size: medium;"><strong>Playing with the NetSensor</strong></span></span></pre><ul><li><span style="font-size: medium;"> Click the bump sensor and see the alarms go off </span></li><li><span style="font-size: medium;"> Breathe into the DHT sensor and see the effect on the humidity and temperature readings</span><span style="font-size: medium;"><strong></strong></span><br /><br /></li></ul><p><span style="font-size: medium;"><strong>More things to do..</strong><br /></span></p><div><span style="font-size: medium;">Can you interface this <a href="http://www.hobbyist.co.nz/?q=ultrasonic-sensor-8m">motion sensor</a> into this kit ? </span></div><div><span style="font-size: medium;">If yes, please let us know and send us the results in a video, the best implementation would grab a cool gift from Hobbyist.<br /></span></div>";s:12:"safe_summary";s:0:"";}}}}


cid: field:node:42
data:
  a:3:{s:4:"body";a:1:{s:3:"und";a:1:{i:0;a:5:{s:5:"value";s:2536:"<p><span style="font-family: verdana, geneva; font-size: medium;">This COMBO Includes</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> - Arduino UNO</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> - Protoshield plugin module &nbsp;</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> &nbsp;&nbsp; - A must have! Makes it easy to wire up any circuit</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> &nbsp;&nbsp;&nbsp;&nbsp; to the Arduino.</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> -&nbsp; Breadboard which fits right in the protoshield.</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> &nbsp;&nbsp;&nbsp; - You can wire up your sensors and motors, LCD right here.</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> - A set of about 50 breadboarding wires of</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> &nbsp; different sizes</span></p><p><span style="font-family: verdana, geneva; font-size: medium;">-&nbsp; <a href="http://www.arduino.cc/en/Main/software" target="_blank">IDE</a> with complete development tools</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> &nbsp;&nbsp; ( For Windows ,Linux &amp; Mac OS X)</span><br /> <br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> Look here for fun projects you can do with this kit :</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> http://hacknmod.com/hack/top-40-arduino-projects-of-the-web/</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> SUPPORT:</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> We are engineers and also hobbyists who passionately involve in embedded system and software projects. These development boards are the best value kits to start your first microcontroller projects. As part of the open source community, we are more than happy to provide you with technical supports in regards to our products if needed.</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> WARRANTY:</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> We provide warranty for any defects in manufacturing. Feel free to get back to us if you have any issues.For any of our products combined shipping is welcome.</span></p>";s:7:"summary";s:0:"";s:6:"format";s:9:"full_html";s:10:"safe_value";s:2496:"<p><span style="font-family: verdana, geneva; font-size: medium;">This COMBO Includes</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> - Arduino UNO</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> - Protoshield plugin module  </span><br /><span style="font-family: verdana, geneva; font-size: medium;">    - A must have! Makes it easy to wire up any circuit</span><br /><span style="font-family: verdana, geneva; font-size: medium;">      to the Arduino.</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> -  Breadboard which fits right in the protoshield.</span><br /><span style="font-family: verdana, geneva; font-size: medium;">     - You can wire up your sensors and motors, LCD right here.</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> - A set of about 50 breadboarding wires of</span><br /><span style="font-family: verdana, geneva; font-size: medium;">   different sizes</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;">-  <a href="http://www.arduino.cc/en/Main/software" target="_blank">IDE</a> with complete development tools</span><br /><span style="font-family: verdana, geneva; font-size: medium;">    ( For Windows ,Linux &amp; Mac OS X)</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> Look here for fun projects you can do with this kit :</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> <a href="http://hacknmod.com/hack/top-40-arduino-projects-of-the-web/">http://hacknmod.com/hack/top-40-arduino-projects-of-the-web/</a></span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> SUPPORT:</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> We are engineers and also hobbyists who passionately involve in embedded system and software projects. These development boards are the best value kits to start your first microcontroller projects. As part of the open source community, we are more than happy to provide you with technical supports in regards to our products if needed.</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> WARRANTY:</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> We provide warranty for any defects in manufacturing. Feel free to get back to us if you have any issues.For any of our products combined shipping is welcome.</span></p>
  ";s:12:"safe_summary";s:0:"";}}}s:16:"uc_product_image";a:1:{s:3:"und";a:1:{i:0;a:11:{s:3:"fid";s:2:"78";s:3:"alt";s:0:"";s:5:"title";s:0:"";s:3:"uid";s:1:"1";s:8:"filename";s:25:"Duemilanove_Breadboad.JPG";s:3:"uri";s:34:"public://Duemilanove_Breadboad.JPG";s:8:"filemime";s:10:"image/jpeg";s:8:"filesize";s:5:"15060";s:6:"status";s:1:"1";s:9:"timestamp";s:10:"1321694807";s:11:"rdf_mapping";a:0:{}}}}s:16:"taxonomy_catalog";a:1:{s:3:"und";a:1:{i:0;a:1:{s:3:"tid";s:1:"4";}}}}


cid: field:node:43
data:
  a:3:{s:4:"body";a:1:{s:3:"und";a:1:{i:0;a:5:{s:5:"value";s:3842:"<p><span style="font-family: verdana, geneva; font-size: medium;">This is the Mega version of the ProtoShield combo. The Mega 1280 has much more capability than the Arduino Duemilanove 2009, it has got more on board memory, more processing power and more I/Os. With this kit, prototyping with the Mega will never be easier, especially for beginners! Circuits can be tested on the breadboard, once they are working, they can be soldered onto the ProtoShield to be made permanent.</span><br /> <br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> This kit includes:</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Arduino Mega 1280&nbsp;</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - USB cable (not shown in photo)</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Mega ProtoShield</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Mini breadboard</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - <a href="http://www.arduino.cc/en/Main/software" target="_blank">IDE</a> with development software for Windows, Linux, Mac and lots of code examples</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - A bunch of breadboard wires (not shown in photo)</span><br /> <br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> The Arduino Mega clone specs :</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> - Powerful ATmega1280 Processor:</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 128KB of Flash, 8KB RAM, 4KB EEPROM</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 53 digital I/O</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 14 PWM Channels</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 16 Analog Inputs</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 4 UART Channels</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - SPI Interface</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - I2C Interface</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - USB interface (Used for power supply + Programming )</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> A Easy start to your first microcontroller project...</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> Free source code and example available at:</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> http://www.arduino.cc/</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> Look here for fun projects you can do with this kit :</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> http://hacknmod.com/hack/top-40-arduino-projects-of-the-web/</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> SUPPORT:</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> We are engineers and also hobbyists who passionately involve in embedded system and software projects. These development boards are the best value kits to start your first microcontroller projects. As part of the open source community, we are more than happy to provide you with technical supports in regards to our products if needed.</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> WARRANTY:</span><br /> <br /><span style="font-family: verdana, geneva; font-size: medium;"> We also provide warranty for any defects in manufacturing. Feel free to get back to us if you have any issues.</span></p>";s:7:"summary";s:0:"";s:6:"format";s:9:"full_html";s:10:"safe_value";s:3877:"<p><span style="font-family: verdana, geneva; font-size: medium;">This is the Mega version of the ProtoShield combo. The Mega 1280 has much more capability than the Arduino Duemilanove 2009, it has got more on board memory, more processing power and more I/Os. With this kit, prototyping with the Mega will never be easier, especially for beginners! Circuits can be tested on the breadboard, once they are working, they can be soldered onto the ProtoShield to be made permanent.</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> This kit includes:</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Arduino Mega 1280 </span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - USB cable (not shown in photo)</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Mega ProtoShield</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - Mini breadboard</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - <a href="http://www.arduino.cc/en/Main/software" target="_blank">IDE</a> with development software for Windows, Linux, Mac and lots of code examples</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - A bunch of breadboard wires (not shown in photo)</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> The Arduino Mega clone specs :</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> - Powerful ATmega1280 Processor:</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 128KB of Flash, 8KB RAM, 4KB EEPROM</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 53 digital I/O</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 14 PWM Channels</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 16 Analog Inputs</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - 4 UART Channels</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - SPI Interface</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - I2C Interface</span><br /><span style="font-family: verdana, geneva; font-size: medium;"> - USB interface (Used for power supply + Programming )</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> A Easy start to your first microcontroller project...</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> Free source code and example available at:</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> <a href="http://www.arduino.cc/">http://www.arduino.cc/</a></span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> Look here for fun projects you can do with this kit :</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> <a href="http://hacknmod.com/hack/top-40-arduino-projects-of-the-web/">http://hacknmod.com/hack/top-40-arduino-projects-of-the-web/</a></span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> SUPPORT:</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> We are engineers and also hobbyists who passionately involve in embedded system and software projects. These development boards are the best value kits to start your first microcontroller projects. As part of the open source community, we are more than happy to provide you with technical supports in regards to our products if needed.</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> WARRANTY:</span></p>
  <p><span style="font-family: verdana, geneva; font-size: medium;"> We also provide warranty for any defects in manufacturing. Feel free to get back to us if you have any issues.</span></p>
  ";s:12:"safe_summary";s:0:"";}}}s:16:"uc_product_image";a:1:{s:3:"und";a:1:{i:0;a:11:{s:3:"fid";s:3:"156";s:3:"alt";s:0:"";s:5:"title";s:0:"";s:3:"uid";s:1:"1";s:8:"filename";s:33:"mega_breadboard_combo (Small).jpg";s:3:"uri";s:42:"public://mega_breadboard_combo (Small).jpg";s:8:"filemime";s:10:"image/jpeg";s:8:"filesize";s:5:"46023";s:6:"status";s:1:"1";s:9:"timestamp";s:10:"1340069147";s:11:"rdf_mapping";a:0:{}}}}s:16:"taxonomy_catalog";a:1:{s:3:"und";a:1:{i:0;a:1:{s:3:"tid";s:1:"4";}}}}


cid: field:node:63
data:
  a:1:{s:4:"body";a:1:{s:3:"und";a:1:{i:0;a:5:{s:5:"value";s:66566:"<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>";s:7:"summary";s:0:"";s:6:"format";s:9:"full_html";s:10:"safe_value";s:64977:"<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>.  This builds on what we have built so far,  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;">  </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.  </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.  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.  I currently don’t test this.  </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.  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></b></p>
  <p> <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;">    </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;">);  </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" />    </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" />    </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);                         </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" />    </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;">);  </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" />    </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></p>
  <p> <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;">    </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;">);  </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" />    </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" />    </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" />    </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;">);  </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" />    </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></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  </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> <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> <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> <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> <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> <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> <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> <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> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> beeper = 0;                    </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> <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" />  </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> <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><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" />  </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> <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;">);         </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" />  </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> <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" />  </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" />  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);              </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> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" />  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> <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" />  </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);         </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>    // 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" />  </span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">  <br class="kix-line-break" />  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);       </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" />  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" />  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" />  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" />  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" />  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> <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> <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> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> buttonState =</span> <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> <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;                 </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" />  <br class="kix-line-break" />  </span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">if</span> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> (buttonState ==</span> <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" />    </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;">    </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;">);  </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" />    </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" />    </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);                         </span> <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> <span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" />    </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;">);  </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" />    </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" />    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" />    </span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</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;">int</span> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> i=0; i &lt;= 15; i++)  </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" />    {<br class="kix-line-break" />      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" />    }<br class="kix-line-break" />    </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" />  <br class="kix-line-break" />    </span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</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;">int</span> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> i=15; i &gt;= 0; i--)  <br class="kix-line-break" />    {    </span> <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" />      </span><span style="font-family: Verdana; color: #cc6600; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">for</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;">int</span> <span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> c=0; c &lt;= 5; c++)  <br class="kix-line-break" />      {    </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" />      beeper=!beeper;<br class="kix-line-break" />        </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> <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" />        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" />        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);     </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" />        </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);            </span> <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> <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: #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" />      }<br class="kix-line-break" />    }  </span> <span style="font-family: Verdana; color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> // end count down loop</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;">digitalWrite</span><span style="font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13, 0);   </span> <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;">    </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;">);  </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> <span style="font-family: Verdana; background-color: transparent; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"> <br class="kix-line-break" />    </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" />    </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" />    </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;">);  </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" />    </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" />  }</span> <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> <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> <span style="font-size: 19px; font-family: Verdana; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> </span></td>
  </tr></tbody></table><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>  | <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>
  ";s:12:"safe_summary";s:0:"";}}}}


cid: field:node:61
data:
  a:1:{s:4:"body";a:1:{s:3:"und";a:1:{i:0;a:5:{s:5:"value";s:1162:"<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>";s:7:"summary";s:0:"";s:6:"format";s:9:"full_html";s:10:"safe_value";s:1190:"<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 </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 </span><span style="font-size: small;">pay you for building it</span></li>
  </ul><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 <a href="mailto:contact@hobbyist.co.nz">contact@hobbyist.co.nz</a> </span><span style="font-size: small;">with above information and you will pretty soon be building cool projects with Hobbyist.</span></p>
  ";s:12:"safe_summary";s:0:"";}}}}


cid: field:node:27
data:
  a:3:{s:4:"body";a:1:{s:3:"und";a:1:{i:0;a:5:{s:5:"value";s:7805:"<p><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Once the Bluetooth is tested and working and you have the motors wired and ready to go,</span></p><p><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">The &nbsp;Robo is ready to go wireless. This is a tutorial details how we go about it.</span><br /> <br /> <br /> <span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Connect the blue tooth to the Arduino board:</span></p><p><span style="font-size: 14px;">Before connecting the Bluetooth to the Arduino, you need to shutdown the Arduino IDE program (the program you use to write upload code to the Arduino). This is because the serial interface of the Arduino may not be shared between the Bluetooth and the PC at the same time, otherwise the Arduino IDE may crash. </span><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Or you can run into this <a href="slow-response-arduino-ide-in-windows" target="_blank">Slow Arduino IDE problem</a> if your Bluetooth is on. Connect the tx of the blue tooth module to the rx (pin0) on the Arduino board and the rx to the tx (pin1) as described in the table below.</span></p><div dir="ltr"><table style="border-collapse: collapse;"><colgroup> <col width="153" /> <col width="149" /> </colgroup><tbody><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Bluetooth</span></td><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Arduino</span></td></tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Vcc</span></td><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">3.3V</span></td></tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">GND</span></td><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">GND</span></td></tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">TXD</span></td><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">RXD</span></td></tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">RXD</span></td><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">TXD</span></td></tr></tbody></table></div><p><br /> <img src="https://lh5.googleusercontent.com/UnYxcM_8wyiEWTSHf8i4yxeF_nW-5zmVzo3u1OZk57_1r0QhnJu3L6kiGRQL1_MO2kdsP__jrNx1Xszu0aEorxwqHqX2ZEDsAwQx0gbxbz6e79ehKxM" border="0" width="532px;" height="400px;" /><br /> <br /> <span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Once open up</span><a href="http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"> </span><span style="font-size: 11pt; font-family: Arial; color: #000099; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: underline; vertical-align: baseline;">puTTY</span></a><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">, and select the correct COM port, the blue tooth module’s LED should be changed from flashing to stays on, which indicates the connection is established. Now it's time to have some fun, key in 'e', 'c', 's', 'f', 'd' in puTTY to control your Rover!</span></p><p>&nbsp;</p><h2>Sprinkle some life into the ROBOT!!!</h2><p>&nbsp;</p><p><iframe width="425" height="349" allowfullscreen="" frameborder="0" src="http://www.youtube.com/embed/Bk9vieYOVOQ?rel=0"></iframe></p><p>&nbsp;</p><p><strong><span style="color: #006400;"><span style="font-size: 16px;"><a href="http://www.hobbyist.co.nz/?q=bluetooth-mars-rover">Get yourself this cool Robot!!</a></span></span></strong></p><div style="border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; border-width: 0px; padding: 0px; margin: 0px;"><span style="color: #000000; font-size: xx-small;">&nbsp;<span class="Apple-style-span" style="border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; border-width: 0px; padding: 0px; margin: 0px;">tags: robotics, robot games, make a robot, build a robot, kid robot, mr robot, create a robot, robot wars</span></span></div><div><span class="Apple-style-span" style="border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; color: #ffffff; border-width: 0px; padding: 0px; margin: 0px;"><br /></span></div>";s:7:"summary";s:0:"";s:6:"format";s:9:"full_html";s:10:"safe_value";s:7783:"<p><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Once the Bluetooth is tested and working and you have the motors wired and ready to go,</span></p>
  <p><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">The  Robo is ready to go wireless. This is a tutorial details how we go about it.</span></p>
  <p> <span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Connect the blue tooth to the Arduino board:</span></p>
  <p><span style="font-size: 14px;">Before connecting the Bluetooth to the Arduino, you need to shutdown the Arduino IDE program (the program you use to write upload code to the Arduino). This is because the serial interface of the Arduino may not be shared between the Bluetooth and the PC at the same time, otherwise the Arduino IDE may crash. </span><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Or you can run into this <a href="slow-response-arduino-ide-in-windows" target="_blank">Slow Arduino IDE problem</a> if your Bluetooth is on. Connect the tx of the blue tooth module to the rx (pin0) on the Arduino board and the rx to the tx (pin1) as described in the table below.</span></p>
  <div dir="ltr">
  <table style="border-collapse: collapse;"><colgroup><col width="153" /><col width="149" /></colgroup><tbody><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Bluetooth</span></td>
  <td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Arduino</span></td>
  </tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Vcc</span></td>
  <td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">3.3V</span></td>
  </tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">GND</span></td>
  <td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">GND</span></td>
  </tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">TXD</span></td>
  <td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">RXD</span></td>
  </tr><tr style="height: 0px;"><td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">RXD</span></td>
  <td style="border: 1px dotted #aaaaaa; vertical-align: top; padding: 7px;"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">TXD</span></td>
  </tr></tbody></table></div>
  <p> <img src="https://lh5.googleusercontent.com/UnYxcM_8wyiEWTSHf8i4yxeF_nW-5zmVzo3u1OZk57_1r0QhnJu3L6kiGRQL1_MO2kdsP__jrNx1Xszu0aEorxwqHqX2ZEDsAwQx0gbxbz6e79ehKxM" border="0" width="532px;" height="400px;" /></p>
  <p> <span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">Once open up</span><a href="http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html"><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;"> </span><span style="font-size: 11pt; font-family: Arial; color: #000099; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: underline; vertical-align: baseline;">puTTY</span></a><span style="font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: normal; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline;">, and select the correct COM port, the blue tooth module’s LED should be changed from flashing to stays on, which indicates the connection is established. Now it's time to have some fun, key in 'e', 'c', 's', 'f', 'd' in puTTY to control your Rover!</span></p>
  <p> </p>
  <h2>Sprinkle some life into the ROBOT!!!</h2>
  <p> </p>
  <p><iframe width="425" height="349" allowfullscreen="" frameborder="0" src="http://www.youtube.com/embed/Bk9vieYOVOQ?rel=0"></iframe></p>
  <p> </p>
  <p><strong><span style="color: #006400;"><span style="font-size: 16px;"><a href="http://www.hobbyist.co.nz/?q=bluetooth-mars-rover">Get yourself this cool Robot!!</a></span></span></strong></p>
  <div style="border-style: initial; border-color: initial; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; border-width: 0px; padding: 0px; margin: 0px;"><span style="color: #000000; font-size: xx-small;"> <span class="Apple-style-span" style="border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; border-width: 0px; padding: 0px; margin: 0px;">tags: robotics, robot games, make a robot, build a robot, kid robot, mr robot, create a robot, robot wars</span></span></div>
  <div><span class="Apple-style-span" style="border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; color: #ffffff; border-width: 0px; padding: 0px; margin: 0px;"><br /></span></div>
  ";s:12:"safe_summary";s:0:"";}}}s:10:"field_tags";a:1:{s:3:"und";a:3:{i:0;a:1:{s:3:"tid";s:2:"14";}i:1;a:1:{s:3:"tid";s:2:"15";}i:2;a:1:{s:3:"tid";s:2:"16";}}}s:11:"field_image";a:0:{}}


cid: field:node:64
data:
  a:1:{s:4:"body";a:1:{s:3:"und";a:1:{i:0;a:5:{s:5:"value";s:125259:"<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>";s:7:"summary";s:0:"";s:6:"format";s:9:"full_html";s:10:"safe_value";s:122743:"<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  RFID module communicates with its UART serial serial port to the Arduino via the SoftwareSerial library.  Also on the RFID module is a signal pin.  When a RFID Tag is within range (6cm max) an LED on lights up and the signal pin changes its state.  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  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.  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;">,  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  </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,  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><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,  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);  </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;">//  RFID tag present.  1 = no  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;  </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};   </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>
  <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><br /></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;">byte</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"> response[32];                            </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" />   </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" />  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" />  </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" />  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" />  <br class="kix-line-break" />  </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" />  </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" />  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" />  </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" />  </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;">);    </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> </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" />  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" />  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);  <br class="kix-line-break" />  </span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">//  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" />  </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" />  </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" />    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" />    reading_tag = 1;<br class="kix-line-break" />    readTag(response);   </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" />    </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;">);  </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" />    </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" />    </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;">);  </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" />    </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;">);  </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;"> //  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" />    </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;">);    </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" />    </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" />    </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" />    </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" />    </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" />    </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" />    </span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">// AABB 2 DF DD0000 0      error reading tag</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;">// AABB 6 20 <span style="color: #ff0000;">6CD01E54D0</span> 0  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>    </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)  </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" />    {</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;">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" />        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" />      }<br class="kix-line-break" />    }<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;">else</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" />  {<br class="kix-line-break" />   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;">"                "</span><span style="font-family: Verdana; vertical-align: baseline; white-space: pre-wrap;">);<br class="kix-line-break" />   reading_tag = 0;<br class="kix-line-break" />  }<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;">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> <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" />  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);     </span><span style="font-family: Verdana; color: #7e7e7e; vertical-align: baseline; white-space: pre-wrap;">//  {0xAA, 0xBB,0x02, 0x20, 0x22};  </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" />  </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);               </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" />  <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;"> index=0;<br class="kix-line-break" />  </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" />  {<br class="kix-line-break" />    </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;">();  </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" />    </span></font></span><br class="kix-line-break" /><span style="font-size: medium;"><font face="Verdana"><span style="white-space: pre-wrap;">    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;">    index++;</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><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;"> 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><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, </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>

  <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  <br class="kix-line-break" />#define motor1 6<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;">int</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"> beeper = 0;        </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;">//  RFID tag present.  1 = no  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;  </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};   </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];                             </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>};  </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" />  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);     </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" />  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" />  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);          </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" />  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" />  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" />  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" />  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" />  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" />  <br class="kix-line-break" />  </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);              </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" />  </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" />  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" />  </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" />  </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;">);      </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" />  </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" />  </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;">);          </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" />  </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;">);        </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" />  </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;">);         </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" />  </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" />  buttonState =! buttonState;           </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" />  </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);  </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;">  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;">  </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;">    </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" />    openLock();<br class="kix-line-break" />  } </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" />  </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" />  {<br class="kix-line-break" />    </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" />    </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" />    readTag(response);  </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" />    <br class="kix-line-break" />    </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)  </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" />    {<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;"> key_Invalid = 0;<br class="kix-line-break" />      </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" />        </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++;}  </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" />      }<br class="kix-line-break" />       </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" />       {<br class="kix-line-break" />        openLock();<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;">else</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" />       {<br class="kix-line-break" />               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" />       }<br class="kix-line-break" />    }<br class="kix-line-break" />  }  <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 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" />  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);     </span><span style="color: #7e7e7e; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">// {0xAA, 0xBB,0x02, 0x20, 0x22};  </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" />  </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);               </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" />  <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;"> index=0;<br class="kix-line-break" />  </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" />  {<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;"> 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;">();  </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" />    <br class="kix-line-break" />    readdata[index] = Val;<br class="kix-line-break" />    index++;<br class="kix-line-break" />   } <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" />    </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" />    </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" />    </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);                 </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" />    </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" />    </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" />  <br class="kix-line-break" />    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" />    </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" />    {<br class="kix-line-break" />      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" />    }<br class="kix-line-break" />    </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" />  <br class="kix-line-break" />    </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--)  </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" />    {</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;"> </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>      </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;">      {<br class="kix-line-break" />        beeper=!beeper;<br class="kix-line-break" />        </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" />        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" />        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" />        </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);          </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" />                            </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" />      }<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;">digitalWrite</span><span style="background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">(13, 0);   </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" />    </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;">);  </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" />    </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: #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" />    </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 lock motor</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;">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>

  </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  </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>
  ";s:12:"safe_summary";s:0:"";}}}}


