<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3480530965459021795</id><updated>2024-12-19T10:19:41.291+07:00</updated><category term="Android OS / Windows Mobile Hard Reset Guides"/><category term="ArduinoBasics"/><category term="best arduino blog"/><category term="Arduino"/><category term="project"/><category term="tutorial"/><category term="samsung corby 2"/><category term="HTC Hard Reset"/><category term="LED"/><category term="LG  Hard Reset"/><category term="Processing"/><category term="Samsung Hard Reset"/><category term="code"/><category term="tips &amp; trik"/><category term="Serial"/><category term="UNO"/><category term="Motorola Hard Reset"/><category term="Sensor"/><category term="rc2"/><category term="communication"/><category term="Nokia X2 Repair Guide"/><category term="Cell Phone Repair Tips"/><category term="Light"/><category term="Neural Network"/><category term="Nokia 5730 Xpressmusic Repair Guides"/><category term="rc1"/><category term="Processing.org"/><category term="RGB"/><category term="Grove"/><category term="433Mhz"/><category term="Nokia Smartphones Hard Reset"/><category term="Bluetooth"/><category term="CSC"/><category term="Colour"/><category term="Mega Bloks"/><category term="PhotoCell"/><category term="RF"/><category term="Android"/><category term="Back propagation"/><category term="Neuron"/><category term="Nokia Hard Reset"/><category term="Remote"/><category term="color"/><category term="file"/><category term="smt"/><category term="switch"/><category term="text"/><category term="Arduino UNO"/><category term="Cayenne"/><category term="Connection"/><category term="FastLED"/><category term="Feed Forward"/><category term="Freetronics"/><category term="Freetronics Eleven"/><category term="HC-SR04"/><category term="Home Automation"/><category term="IoT"/><category term="LED as Sensor"/><category term="MP3"/><category term="NeoPixels"/><category term="Nokia 5800 Xpressmusic Repair Guides"/><category term="PIR"/><category term="PWM"/><category term="Potentiometer"/><category term="Programming"/><category term="Read"/><category term="Seeed Studio"/><category term="SeeedStudio"/><category term="Serial Monitor"/><category term="Shield"/><category term="Sony Ericsson Hard Reset"/><category term="Sound"/><category term="Weight"/><category term="apple iphone 4"/><category term="button"/><category term="comma"/><category term="control"/><category term="data"/><category term="module"/><category term="relay"/><category term="2.5mm"/><category term="5V relay"/><category term="AnalogRead"/><category term="Animation"/><category term="Apple iPad 2"/><category term="Apple iphone"/><category term="Base Shield"/><category term="Bias"/><category term="Blink"/><category term="BufferUntil"/><category term="CSV"/><category term="Canon"/><category term="Ear-clip"/><category term="Eleven"/><category term="Ethernet"/><category term="Example"/><category term="Fun"/><category term="GY-80"/><category term="Google+"/><category term="HC-SR501"/><category term="HMC5883L"/><category term="Heart"/><category term="Heart Beat"/><category term="Heart Rate"/><category term="How to"/><category term="IC Station"/><category term="Intervalometer"/><category term="Layer"/><category term="Learning"/><category term="Mouse"/><category term="Part One"/><category term="Player"/><category term="Portable"/><category term="PowerShot"/><category term="Receiver"/><category term="Review"/><category term="SG-5010"/><category term="SX50 HS"/><category term="Servo"/><category term="Slide Potentiometer"/><category term="Sony Ericsson experia X1"/><category term="Temperature"/><category term="Transmitter"/><category term="USB"/><category term="XBee"/><category term="accelerometer"/><category term="arduino code example"/><category term="brightness"/><category term="delimitted"/><category term="movement"/><category term="photography"/><category term="poll"/><category term="power"/><category term="setup"/><category term="time lapse"/><category term="time-lapse"/><category term="100000"/><category term="144 LED"/><category term="3 of 9"/><category term="3-axis"/><category term="3of9"/><category term="4 Channel"/><category term="96x96"/><category term="9V battery"/><category term="AJAX"/><category term="Activation function"/><category term="Alarm"/><category term="Analog"/><category term="Android Software Tools"/><category term="App"/><category term="Apple iPhone Firmwares"/><category term="Arduino LLC"/><category term="Arduino Nano"/><category term="Arduino SRL"/><category term="Arduino compatible Open-source PLC"/><category term="ArrayList"/><category term="Barcode"/><category term="Basics"/><category term="Beginners"/><category term="Bend"/><category term="BlackBerry Hardware Repair Guides"/><category term="Blackberry FAQ"/><category term="Blackberry Torch 9800"/><category term="Boombox"/><category term="Box"/><category term="BroadcastReceiver"/><category term="CH376S"/><category term="CHAIN BLOCKS"/><category term="Cake"/><category term="Camera"/><category term="Capacitance"/><category term="Capacitive"/><category term="Capture"/><category term="Chainable"/><category term="Clap"/><category term="Click"/><category term="Comet"/><category term="Controllino"/><category term="Cylon"/><category term="DC Motor"/><category term="DTMF"/><category term="Digital"/><category term="Disassembling Manuals and Video Guides"/><category term="Disco"/><category term="DiscoBall"/><category term="Discover"/><category term="Dual Tone Multi Frequency"/><category term="Duinotech L298"/><category term="E-paper"/><category term="Easy"/><category term="EasyEDA"/><category term="EspoTek Labrador"/><category term="Essential"/><category term="Evaluation"/><category term="Fade"/><category term="Fan"/><category term="Fire Starter"/><category term="Flex"/><category term="Fritzing"/><category term="Garage Door Monitor"/><category term="Getting"/><category term="Google Nexus S"/><category term="Guest Project"/><category term="HTC Software Tools"/><category term="Hall Effect"/><category term="Hex"/><category term="Htc Unlock"/><category term="I2C"/><category term="ICStation"/><category term="IR"/><category term="IRTEMP"/><category term="ITDB02"/><category term="ITDB02-1.8SP"/><category term="InputStream"/><category term="Internet"/><category term="Introduction"/><category term="Inventor&#39;s"/><category term="JSON"/><category term="Jack"/><category term="Jumper"/><category term="Kit"/><category term="Kyocera Hard Reset"/><category term="LCD"/><category term="LED Bar"/><category term="LLC"/><category term="Laser"/><category term="Level"/><category term="Library"/><category term="Loadstrings"/><category term="MDP"/><category term="MEGA"/><category term="MT8870"/><category term="Magnet"/><category term="Magnetometer"/><category term="Magzor"/><category term="Mechanotronic Design Process"/><category term="Mercator"/><category term="Motion detector"/><category term="Motor"/><category term="NPN Transistor"/><category term="Nano"/><category term="Nextion Enhanced"/><category term="Nokia 5310 Xpressmusic Repair Guides"/><category term="OLED"/><category term="OWI Robotic Arm"/><category term="Odin Flasher"/><category term="OneArduino"/><category term="OpenLab"/><category term="OutputStream"/><category term="P2N2222AG"/><category term="PCB"/><category term="Part Two"/><category term="Parts"/><category term="Photo"/><category term="Photoresistor"/><category term="Piano"/><category term="Piezo"/><category term="Play songs"/><category term="Playground"/><category term="Plus"/><category term="Port Forwarding"/><category term="Prextron"/><category term="Projects"/><category term="RFID"/><category term="RGB5050"/><category term="Red"/><category term="Replay"/><category term="Resistor"/><category term="SMS"/><category term="SRL"/><category term="Samsung Flashfiles"/><category term="Samsung Smartphone OS"/><category term="Samsung Tool"/><category term="ScottC"/><category term="Scroll Bar"/><category term="Security"/><category term="Security Phone Code Reset"/><category term="Seeeduino Cloud"/><category term="Selfie"/><category term="Sensing"/><category term="Sequence"/><category term="Sigmoid"/><category term="Sliding potentiometer"/><category term="Smartphone"/><category term="Sonar"/><category term="Sony Ericsson Experia Neo"/><category term="Sony Ericsson PlayStation phone"/><category term="Sony Ericsson experia X8"/><category term="Sparkfun"/><category term="Speaker"/><category term="Spirit"/><category term="Sprint 7700 hardware repair"/><category term="Started"/><category term="Stepper Motor"/><category term="Strobe"/><category term="Stroboscope"/><category term="SuperBlink"/><category term="TFT"/><category term="Temboo"/><category term="Toast"/><category term="Training"/><category term="Transistor"/><category term="Trigger"/><category term="Tutorials"/><category term="URL"/><category term="USB disk"/><category term="USB stick"/><category term="UTFT"/><category term="UUID"/><category term="Ultrasonic"/><category term="Ultrasonic sensor"/><category term="Update Two"/><category term="Values"/><category term="WIZ550io"/><category term="WIZnet"/><category term="WS2812-B"/><category term="Water"/><category term="Weather"/><category term="Web Server"/><category term="Write"/><category term="Yellow"/><category term="adafruit"/><category term="addition"/><category term="append"/><category term="buzzer"/><category term="celebration"/><category term="computer"/><category term="constrain"/><category term="controlled"/><category term="delimiters"/><category term="detector"/><category term="display"/><category term="double"/><category term="echo"/><category term="epaper"/><category term="floats"/><category term="hexadecimal"/><category term="iPhone Jailbreaking"/><category term="import"/><category term="ioShield-A"/><category term="jQuery"/><category term="javascript"/><category term="logcat"/><category term="map"/><category term="myDevices"/><category term="panel"/><category term="pictures"/><category term="precision"/><category term="range sensor"/><category term="rbm"/><category term="receive"/><category term="save"/><category term="screen"/><category term="send"/><category term="sketch"/><category term="software"/><category term="splitTokens"/><category term="storage"/><category term="video"/><category term="views"/><title type='text'>malikmal</title><subtitle type='html'>several information who can usefull for you all</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default?start-index=26&amp;max-results=25'/><author><name>Ikmalil Birri</name><uri>http://www.blogger.com/profile/00809121074236419552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>275</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-6295304014052391401</id><published>2017-08-08T09:12:00.000+07:00</published><updated>2018-03-28T22:35:13.211+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino UNO"/><category scheme="http://www.blogger.com/atom/ns#" term="Duinotech L298"/><category scheme="http://www.blogger.com/atom/ns#" term="Nextion Enhanced"/><category scheme="http://www.blogger.com/atom/ns#" term="Piano"/><category scheme="http://www.blogger.com/atom/ns#" term="Play songs"/><category scheme="http://www.blogger.com/atom/ns#" term="Stepper Motor"/><title type='text'>Nextion Enhanced Stepper Motor Piano Project</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/pNTjRYohDl8?showinfo=0&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;      &lt;/div&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;h4&gt;Introduction&lt;/h4&gt;&lt;br /&gt;Nextion is a programmable human machine interface (HMI) that can be customized and designed to simplify the interaction between you and your project.     &lt;br /&gt;This Nextion Enhanced module (NX4827K043) with a resistive touch screen display, has some additional features not seen in previous traditional versions of the Nextion series.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A built in real time clock (RTC)&lt;/li&gt;&lt;li&gt;Accessible flash memory (32MB)&lt;/li&gt;&lt;li&gt;GPIO functionality&lt;/li&gt;&lt;li&gt;Faster clock speed&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Before you connect the Nextion Enhanced module to your project, you need to design your interface with the free Nextion Editor. The editor can be &lt;a href=&quot;http://nextion.itead.cc/download.html&quot;&gt;downloaded here.&lt;/a&gt;&lt;br /&gt;In this project, I will be designing a simple dynamic interface, which will allow me to interact with a stepper motor in two different ways.&lt;br /&gt;The first interface will let me control the direction and speed of the stepper motor through the use of a simple GUI. I will have left and right arrows for the direction, and up and down arrows for the speed. I will also map the Expansion board to this interface for a more tactile experience.&lt;br /&gt;The second interface will be more musical in nature.  I will design a functional “Stepper motor piano” that will allow me to play simple songs using the rotational sounds of the stepper motor.  This concept is not new, but I will show you how easy it is to make.&lt;/div&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;      &lt;br /&gt; &lt;div&gt;&lt;br /&gt;&lt;h4&gt;Parts Required:&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://store.arduino.cc/usa/arduino-uno-rev3&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://goo.gl/aOrZ1G&quot;&gt;Nextion Enhanced NX4827K043 from iTead Studio&lt;/a&gt; (more info &lt;a href=&quot;https://www.itead.cc/wiki/NX4827K043&quot;&gt;here&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.itead.cc/nextion-expansion-board.html&quot;&gt;Nextion Expansion board for Nextion Enhanced display&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.officeworks.com.au/shop/officeworks/p/sandisk-16gb-ultra-microsdhc-memory-card-br198570&quot;&gt;Micro SDHC Card&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.officeworks.com.au/shop/officeworks/p/qpix-all-in-one-card-reader-bccrlmai2&quot;&gt;SD Card Reader/Writer&lt;/a&gt; - to transfer files from computer to SDHC card&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.sparkfun.com/products/12615&quot;&gt;Breadboard&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.sparkfun.com/products/10846&quot;&gt;Stepper Motor (42BYGHM809)&lt;/a&gt; - (Here is the &lt;a href=&quot;https://cdn.sparkfun.com/datasheets/Robotics/42BYGHM809.PDF&quot;&gt;datasheet&lt;/a&gt;) &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.jaycar.com.au/100uf-25vdc-electrolytic-rb-capacitor/p/RE6140&quot;&gt;100 uF Capacitor&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.jaycar.com.au/arduino-compatible-stepper-motor-controller-module/p/XC4492&quot;&gt;Duinotech Stepper Motor Driver (L298) - [JayCar part# XC4492] &lt;/a&gt; (Here is the &lt;a href=&quot;https://www.jaycar.com.au/medias/sys_master/images/8978852577310/XC4492-dataSheetMain.pdf&quot;&gt;datasheet&lt;/a&gt;).&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.jaycar.com.au/0-to-30vdc-0-to-5a-regulated-power-supply/p/MP3840&quot;&gt;External Power supply - e.g. Regulated Lab Power Supply&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;      &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;h4&gt;Project Scope&lt;/h4&gt;&lt;br /&gt;My project will show a splash screen when the project is powered up.  After 3 seconds, the first interface will display.      &lt;br /&gt;The first interface will have 4 arrows:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Left and Right arrows for the stepper motor direction of rotation&lt;/li&gt;&lt;li&gt;Up and down arrows to increase/decrease stepper motor rotational speed&lt;/li&gt;&lt;li&gt;Next Page button – to jump to the next interface&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Each arrow/button on the first interface will be mapped to a specific button on the expansion board.  Eg.     &lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Left/Right arrow is mapped to Left/Right button&lt;/li&gt;&lt;li&gt;Up/Down arrow is mapped to Up/Down button&lt;/li&gt;&lt;li&gt;Next page button is mapped to Enter button on the expansion board&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The second interface will look like a piano on the Nextion Enhanced display. Each key on the piano will transmit a specific and unique number to the Arduino.     &lt;br /&gt;The specific number received by the Arduino will allow it to set the speed of stepper motor which will ultimately affect the frequency of sound it produces.  Therefore when the “C” key is pressed on the Nextion display, the stepper motor will rotate at a frequency that sounds like a “C” note.     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img alt=&quot;Table describes the stepper motor speed value and the number that is transmitted to the Arduino for each piano key&quot; border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;874&quot; height=&quot;329&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ8Om2XFyVGsuWXxW4400tcT0Q3Wr-6_0yCIjmLL8_smn4kvcBk36nRFmSwGL6LeC36_4mdzxFLVnIppOOujYfjOU9VHzJGdIWfp6StoLmbyigTEH9WyVIIssGAFEMEZJgVcjorJxztXM/s640/Piano+Key+Table.png&quot; title=&quot;Piano Key Table&quot; width=&quot;640&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The stepper motor speeds can be determined by tuning the motor to specific notes using the first interface and an iPhone app called &lt;a href=&quot;https://itunes.apple.com/us/app/tuner-t1-free-tune-any-musical-instrument-guitar-ukulele/id453056916&quot;&gt;Tuner T1 Free&quot;. &lt;/a&gt;    &lt;br /&gt;If you plan to replicate this project, you will need to determine the relevant speeds of your own stepper motor, and substitute your values into the Arduino code later on in this tutorial.     &lt;/div&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;      &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;h4&gt;Create a New Project&lt;/h4&gt;&lt;br /&gt;The first step is to create the interfaces in the Nextion Editor on your PC. You can download the &lt;a href=&quot;http://nextion.itead.cc/download.html&quot;&gt;Nextion Editor here.&lt;/a&gt;.        Load up the Nextion Editor and create a new project.     &lt;br /&gt;When you start a new project, you need to make sure that you select the correct Nextion device from the available options.     &lt;br /&gt;I am using the “Nextion Enhanced NX4827K043” device.     &lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Select File → New&lt;/li&gt;&lt;li&gt;Select a name for the project and save it to a suitable place on the hard drive&lt;/li&gt;&lt;li&gt;Select the appropriate Nextion device from the available options             &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;My device has a screen size of 480 x 272 pixels&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img alt=&quot;Selection of the NX4827K043_011 module from other available selections&quot; border=&quot;0&quot; data-original-height=&quot;662&quot; data-original-width=&quot;881&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguVu9EV2GfCo4OMslyMo9hK_WQ0GoBKsYsMHAKtyaPTuhFSs5cmvnNmgwmWYaRNmCAg7F5TrLLUfy8Q4Vuy4QpuweiJGSFbZ2N-rglnEsdjR_XqCJwWQLU0JKGNjYH5DWpSM-yQtEz4Vk/s640/000b+Nextion+Editor+New+Project.png&quot; title=&quot;NX4827K043_011 selection&quot; width=&quot;640&quot; /&gt;      &lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;     &lt;br /&gt;&amp;nbsp;             &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;h4&gt;Project Resources&lt;/h4&gt;&lt;br /&gt;You need to import all of the resources (eg. pictures and fonts) into your project, and then design the interface to suit your specific needs.      &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Fonts&lt;/h3&gt;&lt;br /&gt;I will not be using any fonts in my project, but if you wanted to write any text to the display, you will need to generate a font in the Nextion Editor.     &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;A&quot;&gt;&lt;li&gt;Tools → Font Generator                 &lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Select the Height of the Font (eg. 16)&lt;/li&gt;&lt;li&gt;Select the Font code type (eg. iso-8859-2)&lt;/li&gt;&lt;li&gt;Select if you want it to be in Bold or not&lt;/li&gt;&lt;li&gt;Choose the Font you want to use (eg. Arial)&lt;/li&gt;&lt;li&gt;Choose the spacing (eg. 0)&lt;/li&gt;&lt;li&gt;And finally give this Font a unique name (e.g. Arial_16)&lt;/li&gt;&lt;li&gt;Push the “Generate Font” button on the bottom right of the window&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img alt=&quot;Dialog box for the font generator in the Nextion Editor&quot; border=&quot;0&quot; data-original-height=&quot;436&quot; data-original-width=&quot;442&quot; height=&quot;393&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7O-TCigTC-Oxc5fEmGIHVWtDCLigJELS6WL9-_jrsvQtS_x9fqgqk1gvpjRzZr_e_euGsu_ZXAe_OavpNbz4JNd9IEweyz7DjWAV_3MjbYwMbmcuYyq_bFpfktmxwgVaRAqcxW6A6CWE/s400/001+Font_Generator_Arial_16.png&quot; title=&quot;Font creator&quot; width=&quot;400&quot; /&gt;       &lt;/div&gt;&lt;br /&gt;Once you press the Generate Font button, it will get you to save the font using a *.zi extension,        and will automatically ask you if you would like to “Add the generated font?” to the project.        If you are happy with the font, and would like to use this font in your project, then select “Yes”, otherwise select “No” and start again.     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img alt=&quot;Font generator acknowledgement, dialog box&quot; border=&quot;0&quot; data-original-height=&quot;160&quot; data-original-width=&quot;447&quot; height=&quot;141&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPqBi7JwTMq_IGJYBme26vbCQgkDOWLZ12yfAQEOucwIyk9IxqNFqeIniSUa7ZW-2e0BWQCH3P0Npq__QxMEmAcHGHNAfQ8nxlcRtj06-iefxlwX44wf33Agy32W2kRDwap8HTUpu-kIY/s400/002+Font_Generator_Add+the+generated+font.png&quot; title=&quot;Add the generater font&quot; width=&quot;400&quot; /&gt;      &lt;/div&gt;&lt;br /&gt;You cannot add any text to your project until you have imported or added a font. All of your project fonts will be displayed in the fonts window.     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img alt=&quot;A list of available fonts in the Nextion editor (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;309&quot; data-original-width=&quot;217&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgFG7tER7rQTgsbGXjMyjCEAZV8pHXQ3evBYlt0LcFWjEopXFK_ZEm-_wLVTcs5LIRcICmzwOF_V2RGZMN7IDKe1OnxoRT6cDdIG49o5zIxMIRZHxc8pdT_3r5SkufZ2ALt-i0zJQkJoI/s400/003+Nextion+Editor+Available+Fonts.png&quot; title=&quot;Font List&quot; width=&quot;280&quot; /&gt;      &lt;/div&gt;&lt;br /&gt;Each font will automatically be indexed, so that you can reference the font programmatically if required.        In fact all resources that you add to your project are assigned a number and incremented by one for every resource added. For some resources, you can see this number to the left of the item.        E.g. In the picture above, the Courier Font has an index of 0, whereas the Arial font has an index of 1.        If you delete a resource, the index number may change for that item.      &lt;/div&gt;&lt;br /&gt;&amp;nbsp;      &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;h3&gt;Pictures&lt;/h3&gt;&lt;br /&gt;As I said before, I will not be using any fonts for my project because the words on the screen will not be changing in any way.       I can get away with designing a “Picture” and importing that into the project.  I will need 3 pictures for my project.   &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Splash screen&lt;/li&gt;&lt;li&gt;Stepper Motor Controller&lt;/li&gt;&lt;li&gt;Stepper Motor Piano&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;On the Nextion Enhanced NX4827K043 device, each picture must be   &lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;480 x 272 pixels in size&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;We will now import the following pictures into the Nextion Editor so that we can use them in the project.     &lt;br /&gt;In the bottom left hand corner of the Nextion editor is the “Fonts and Picture” resource window:   &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Select the Picture tab&lt;/li&gt;&lt;li&gt;Then select the “+” icon&lt;/li&gt;&lt;li&gt;This will open a dialog box to allow you to select the picture(s) to add to the project.  You can select more than one picture to import.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;I imported the following pictures from my computer:   &lt;br /&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;       &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Splash Screen&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;ArduinoBasics Splash Screen image (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;272&quot; data-original-width=&quot;480&quot; height=&quot;226&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxTUVntT1jOPOGD_mA40FMnf-r0PiUTWsZxzPyI0OBpzXly3Wrbk0eFOXLpwyXGcYmEg3vOoAWGeU74uHKCH_fkFBFJWysXcQ2sd45sMz_07uZ4mav3L-NqQwS2aXHov3ZnNvUtWsl4JE/s400/004+ArduinoBasicsCommunity+Logo.png&quot; title=&quot;ArduinoBasics Splash Screen&quot; width=&quot;400&quot; /&gt;    &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;      &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Interface 1: Stepper Motor Controller&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Stepper Motor Controller Background Image for Interface (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;272&quot; data-original-width=&quot;480&quot; height=&quot;226&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQyWTnz9tk8v_dbP-FMWeR8Fi7jdwGgFeoKu9qFn3m5svtTr-Qb7MimvQ1diGJmdBgDJo1p6CHXASFqi6FMyak3xwBpu9kDB7UJL4lebGxhUNS1-itRiPwFKtXDlBTNI-sbcLZoG-yU3k/s400/005+StepperMotorController.png&quot; title=&quot;Stepper Motor Controller Interface Image&quot; width=&quot;400&quot; /&gt;    &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;      &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Interface 2: Stepper Motor Piano&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Stepper Motor Piano Background Image for Interface 2 (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;272&quot; data-original-width=&quot;480&quot; height=&quot;226&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQRAR7k_W6wSJlpalkJu5r6xgXEkQwW36j8MgJGA_cCuwnjd7XutD_K140zVX8lXhPphd3oTDQUtIzVuxdyPG_OiFVHNhmkka_TZj4MVCN-rzvZBUqJc3co_u7jSzM9-3FqVdIsIW4pUQ/s400/006+Piano+AtoC+480x272.png&quot; title=&quot;Stepper Motor Piano Interface Image&quot; width=&quot;400&quot; /&gt;    &lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;         &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;h4&gt;Creating the GUI&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Pages&lt;/h3&gt;&lt;br /&gt;Every resource will get an ID based on the order it is added, and each resource will automatically get a name. You can change the name of the resource or object, but you cannot edit the ID.     &lt;br /&gt;Three pages will be designed to meet the criteria described above.     &lt;br /&gt;To add a page, you simply select the “Add” icon from the “page window”. And keep adding pages until you have a total of 3 pages (page0, page1 and page2).     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Add pages to the project in the Nextion Editor (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;296&quot; data-original-width=&quot;217&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2nGtJCPA4Qz5WUPdKE7dGI7FyRDqgatrMKR5stdSzMOsF7dSCCf99Wr22kHLCv24PAP6ZBQkt9B0MfaoZTSIBgMThQpkJmcNuaFc59vT2cJk60NhBEJztLEl_Ghk3gTMovCBg9qw1NMY/s400/007+Nextion+Editor+Add+Page.png&quot; title=&quot;Page section in Nextion Editor&quot; width=&quot;293&quot; /&gt;        &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;     &lt;br /&gt;&amp;nbsp;          &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Page 0 - Splash Screen&lt;/h3&gt;&lt;br /&gt;When the Nextion is powered up, the splash screen will be displayed for 3 seconds before it shows the Stepper Motor Controller screen. I used the following steps to create the splash screen.     &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;          Add the splash screen picture to page0                &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Select “page0” from the Page window&lt;/li&gt;&lt;li&gt;Select “Picture” from the Toolbox window&lt;/li&gt;&lt;li&gt;Double-click the “pic” attribute from the Attribute window&lt;/li&gt;&lt;li&gt;Select the splash screen image from the list&lt;/li&gt;&lt;li&gt;Press the OK button&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;            Add a Timer to page0               &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Select Timer from the Toolbox window&lt;/li&gt;&lt;li&gt;Change the “tim” attribute from 400 to 3000 in the Attribute window&lt;/li&gt;&lt;li&gt;Enter “page page1” in the User code section of the Timer Event(0)&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;This timer event will make the Nextion jump to page1 after 3 seconds.     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Attributes of the Timer Event in the Nextion Editor (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;308&quot; data-original-width=&quot;217&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEI2p_gJtlNAGlxEpBOENtJOlpyypwhiSW_Svx559yhJW-lIE2jV5AdWeS5HayHzoAkR9cq-n9ZR5kBtmvGNJFQEZI1nRx9xcx98V1rvhvSHf5qfkjFd7UGTTNtKU59_BnC4l9DmdQa-k/s400/SetSplashTime.png&quot; title=&quot;Attribute window of the Nextion Editor&quot; width=&quot;282&quot; /&gt;      &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;     &lt;br /&gt;&amp;nbsp;               &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Page 1 - Stepper Motor Controller&lt;/h3&gt;&lt;br /&gt;This page is designed to control the direction and speed of the stepper motor.     &lt;br /&gt;There will be two buttons for the direction (Left and Right), and two buttons for the speed (Faster and Slower).          And one more button to jump to the next page (i.e. the Stepper Motor Piano page).         These buttons will also be mapped to the Nextion expansion board.         The tactile buttons of the expansion board will provide an alternative method of controlling the motor.     &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;            Add the Stepper Motor Controller picture to page1             &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Select “page1” from the Page window&lt;/li&gt;&lt;li&gt;Select “Picture” from the Toolbox window&lt;/li&gt;&lt;li&gt;Double-click the “pic” attribute from the Attribute window&lt;/li&gt;&lt;li&gt;Select the “Stepper Motor Controller” image from the list&lt;/li&gt;&lt;li&gt;Press the OK button&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;           Add Hotspots over each button on the Stepper Motor Controller image            &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Select “Hotspot” from the Toolbox window&lt;/li&gt;&lt;li&gt;Drag and resize the Hotspot so that it covers the “Left” button                 &lt;ol type=&quot;i&quot;&gt;&lt;li&gt;This is the area that will respond to “Left button” presses.&lt;/li&gt;&lt;li&gt;It will be transparent when uploaded to the Nextion board&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;Select the “Touch Press Event” tab in the Event window&lt;/li&gt;&lt;li&gt;Un-Check the “Send Component ID” checkbox &lt;/li&gt;&lt;li&gt;Type the following code into the “User Code” Section of the Event window:                 &lt;ul&gt;&lt;li&gt;print “L”&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;                Change the object name of the hotspot to “Left” using the following process:                 &lt;ol type=&quot;i&quot;&gt;&lt;li&gt;Select objname from the attribute window and change the text from “m0” to “Left”&lt;/li&gt;&lt;li&gt;It is not compulsory to change the hotspot object name; however it will help later on.&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;                Repeat steps 2a-2f for each of the other buttons in the following order and as per the table below                 &lt;ol type=&quot;i&quot;&gt;&lt;li&gt;Right&lt;/li&gt;&lt;li&gt;Faster&lt;/li&gt;&lt;li&gt;Slower&lt;/li&gt;&lt;li&gt;Next&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img alt=&quot;Shows how to program each button on the first inteface of this project in the Nextion Editor (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;208&quot; data-original-width=&quot;936&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgsj85jh5X7NjSW7aoXbzWLf57h_MH13SCx0GDK6HORo93w9tx4pciGJFGz36bi3y2wUKb5cGXs-5dAscfVh_mymkd9ri4I0ovSxkPgT6L35bwscQ4ERbck5AkQTFHcH1NBALLV9ty58g/s640/Button+Hotspot+table.png&quot; title=&quot;Button Table for Interface One&quot; width=&quot;640&quot; /&gt;          &lt;/div&gt;&lt;br /&gt;The decimal ASCII code for the letter “L” is 76, hence when the Nextion Enhanced display sends the letter L to the Arduino using the print “L” command,            the Arduino will receive the number 76. When the right button is pressed, it will receive the number 82, and so on.         &lt;br /&gt;The “Next” button does not transmit anything to the Arduino, it is simply there to jump to the next interface on the Nextion Enhanced display,            hence the reason why the user code is different for that button.         &lt;br /&gt;&lt;ol start=&quot;3&quot; type=&quot;1&quot;&gt;&lt;li&gt;            Map the buttons to the Expansion board               &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Select “page0” and then “page1” from the Page window&lt;/li&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Select Page 1 in the Nextion Editor (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;296&quot; data-original-width=&quot;217&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwX_nSNT2GfdHar5d3zZEzS7oievkysi_F0CCETUpi5qB_7cqbSV6Yr92XXTNj9ZvdwaeSUQ824vSAqeXahD-U1sco-JioTVodh_0phfszfIH-1D4fXPlnopKIU4-AHVvPt9AG_hHtphI/s400/Page1+selected.png&quot; title=&quot;Select page1&quot; width=&quot;293&quot; /&gt;                  &lt;/div&gt;&lt;br /&gt;&lt;li&gt;Select the “Preinitialize Event” tab from the Event window&lt;/li&gt;&lt;li&gt;Enter the following code into the “User Code” field of the Preinitialize Event tab:                 &lt;ul&gt;&lt;li&gt;cfgpio 5,1,Left&lt;/li&gt;&lt;li&gt;cfgpio 2,1,Right&lt;/li&gt;&lt;li&gt;cfgpio 4,1,Faster&lt;/li&gt;&lt;li&gt;cfgpio 3,1,Slower&lt;/li&gt;&lt;li&gt;cfgpio 1,1,Next&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;User code for the preinitialize event box in page1 (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;245&quot; data-original-width=&quot;572&quot; height=&quot;273&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOR7Mwxpjy_C1GcJhIU4-P-ZG_oWh5tZ0pv9F6lwvHQYFqbggvkcD9BDQC3PVdkn-drdhhronCF1q_Ar3tpVxkhtcr86fZ1-TFhPrz0MgRrYMklmwlw9Mt6fwyOjSBgn3m72x-Mb3k1Po/s640/Expansion+board+config+CORRECT+version.png&quot; title=&quot;Preinitialize Event Code&quot; width=&quot;640&quot; /&gt;          &lt;/div&gt;&lt;br /&gt;&lt;b&gt;Please note:&lt;/b&gt; There is one space between cfgpio and the number next to it, but there are no other spaces on each line.           If you introduce extra spaces, it will not compile.       &lt;br /&gt;This code maps the buttons on the expansion board to the hotspot objects on page1.           For example, when the Left button (IO5) on the expansion board is pressed, it simulates the actions or events associated with hotspot m0/Left.           In this case it will send a value of “L” (76) to the Arduino.        &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Expansion Board Buttons (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;193&quot; data-original-width=&quot;1001&quot; height=&quot;122&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtGte3mbNxXT2h16ZYVXjAa9c60hHXeoEWxczgmbcbShJVhdk-RSGNLSSeFRem2JVYcWr5_WjnjbZF9rtvWg6SckFQL51-228KnU_QaH6k3FYz1IbXR-V_3e8Dj9-l8HOmEWURJO1mtn8/s640/Expansion+Board+Functionality+table.png&quot; title=&quot;Expansion Board Buttons&quot; width=&quot;640&quot; /&gt;        &lt;/div&gt;&lt;br /&gt;The IO number is marked within brackets on the expansion board.        &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Expansion Board (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;757&quot; data-original-width=&quot;1404&quot; height=&quot;344&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXBeGDxmiNpw35OZm_rSWaGxXYH0IwZ4hjyG7AQUY4yNjZjtPjgKi9jbRZDDsi-G5J3IM69ci8XQfIheA8YVa6dTGgNYP0NxwX58fzaBG52pXD9_GOFsnXos8guMSPxGgFM6DGxQ-5OJU/s640/Expansion+board+with+transparency.png&quot; title=&quot;Expansion Board&quot; width=&quot;640&quot; /&gt;        &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;     &lt;br /&gt;&amp;nbsp;               &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Page 2 - Stepper Motor Piano&lt;/h3&gt;&lt;br /&gt;This interface will be designed to look like a piano, and will allow me to control the stepper motor such that it produces a note in the same key        as the one I press on the Nextion display. The stepper motor will produce the note by rotating at a specific frequency.     &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;            Add the Stepper Motor Piano picture to page2             &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Select “page2” from the Page window&lt;/li&gt;&lt;li&gt;Select “Picture” from the Toolbox window&lt;/li&gt;&lt;li&gt;Double-click the “pic” attribute from the Attribute window&lt;/li&gt;&lt;li&gt;Select the “Stepper Motor Piano” image from the list&lt;/li&gt;&lt;li&gt;Press the OK button&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;           Add Hotspots over each key on the Stepper Motor Piano image            &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;Select “Hotspot” from the Toolbox window&lt;/li&gt;&lt;li&gt;Drag and resize the Hotspot so that it covers the the “A” key.               &lt;ol type=&quot;i&quot;&gt;&lt;li&gt;This is the area that will respond to “A-key” presses.&lt;/li&gt;&lt;li&gt;It will be transparent when uploaded to the Nextion board&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;Select the “Touch Press Event” tab in the Event window&lt;/li&gt;&lt;li&gt;Type the following into the “User Code” section               &lt;ul&gt;&lt;li&gt;print 1&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;              Repeat steps 2a-2d for each of the other keys as per the table below               &lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;The User code for each key in interface two (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;480&quot; data-original-width=&quot;1000&quot; height=&quot;306&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSmoSyq9uFOrV1IHKUhaRSZ8Wj4Eaxknk6Tn0jfaC21trfV99X1-AfRbp8t0OutXF7Gnv66QlG97IyQLokHTMUPL6AWtYmnbZrDi5nodABVTlUFwCHL9Mp4FqfCkQjONA3bfOyoguZW6I/s640/Key+Print+codes.png&quot; title=&quot;User Code Table&quot; width=&quot;640&quot; /&gt;           &lt;/div&gt;&lt;br /&gt;When the specific key is pressed, the Nextion Enhanced board will transmit the printed number, followed by three 0x00 values. The terminating values can be ignored.       &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Designing the second interface in the Nextion Editor (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;684&quot; data-original-width=&quot;1362&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXOj_7z9jkB92W3-CUij3xKKeEaphwCFHI9YlHTiNWXSneNFwM8e2Kgh0IEWppcQrd9OberKPgQYcs3Mn0ksAGbQuMi3vsVdhAdanWlZYYAooU3ofDqhux_7ac32bIISBhvkefR3hMJE/s640/Piano+Hotspots.png&quot; title=&quot;Interface Two&quot; width=&quot;640&quot; /&gt;           &lt;/div&gt;&lt;br /&gt;&lt;ol start=&quot;3&quot; type=&quot;1&quot;&gt;&lt;li&gt;           The “Back” button will allow me to jump back to the previous interface on the Nextion Enhanced board.             &lt;ol type=&quot;a&quot;&gt;&lt;li&gt;               Create a hotspot for the back button using the following process:                  &lt;ol type=&quot;i&quot;&gt;&lt;li&gt;Select Hotspot from the Toolbox window&lt;/li&gt;&lt;li&gt;Move/Resize the hotspot over the “Back” button&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;Select the Event window&lt;/li&gt;&lt;li&gt;Make sure the “Touch press event” tab is selected&lt;/li&gt;&lt;li&gt;Type:    page page1     into the User Code section&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;     &lt;br /&gt;&amp;nbsp;          &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Debugging&lt;/h3&gt;&lt;br /&gt;The good thing about the Nextion Editor, is that you can test out the interface functionality before uploading it to the board.     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;Nextion Editor Menu Items (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;27&quot; data-original-width=&quot;382&quot; height=&quot;44&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJIS0SHQ84C4h6sDn42FCOKs5UmLso2o-zirU2kMasaow1ot2D_GRqSAkFQXT4BhjGZ5VDWpHW5urP3NBn0dQoypd8r7qlWoGOP5I0RhfHFMr2S8o0VaF8bpVNanL8INuSJoY6vu2NaDQ/s640/Save+Compile+Debug+Menu+items.png&quot; title=&quot;Nextion Editor Menu Items&quot; width=&quot;640&quot; /&gt;       &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Save the project by pressing the save button on the task bar&lt;/li&gt;&lt;li&gt;Then press the compile button&lt;/li&gt;&lt;li&gt;Then press the debug button.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;A Nextion emulator window will appear. This window should respond in the same manner as Nextion module after the Nextion file is uploaded to the board.         This emulator is a great way to test out your interface and to make sure it looks and works as expected.          Once I was happy with the interface(s), I transferred the compiled Nextion file onto an SD card:     &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Press the compile button&lt;/li&gt;&lt;li&gt;File → Open Build Folder&lt;/li&gt;&lt;li&gt;Select the *.tft file with the same name as that of the project&lt;/li&gt;&lt;li&gt;Copy it to a micro SDHC card&lt;/li&gt;&lt;li&gt;Insert the SDHC card into the SD card slot on the Nextion display&lt;/li&gt;&lt;li&gt;Power up the Nextion board&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Wait for the file to flash the Nextion board, and you should see a message that looks like this:     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;img alt=&quot;The message displayed after successful flashing of the Nextion board (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;797&quot; data-original-width=&quot;1197&quot; height=&quot;265&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaAE6CjJ6aPUH5vyRU37nV_AcDDC3tFceBT-qJRpMbCUKgiAT-bNS6dtMRnFwvzGxCMl7gvz8SDEKTCdsd9csvzV5KpyBb8rgyD4foDQDcwpxCpVsUhiMkh9kmQ0vXAkfVrqls4gePfAc/s400/Update+Successed.jpg&quot; title=&quot;Update Successed!&quot; width=&quot;400&quot; /&gt;       &lt;/div&gt;&lt;br /&gt;The next step is to power off the Nextion board, and remove the SDHC card.     &lt;/div&gt;&lt;br /&gt;&amp;nbsp;    &lt;br /&gt;&amp;nbsp;        &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;h4&gt;ARDUINO SETUP&lt;/h4&gt;&lt;br /&gt;The Nextion Enhanced display is ready, and now it is the Arduino’s turn.          The Arduino is programmed to receive Serial messages from the Nextion Enhanced display and control the stepper motor based on the letters or numbers received.          The unique letters or numbers being transmitted from the Nextion board, allow the Arduino to understand what button is being pressed,          and it uses those numbers or letters to control the flow of code in order to perform specific stepper motor actions.     &lt;br /&gt;&lt;br /&gt;&amp;nbsp;          &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Arduino Libraries and IDE&lt;/h3&gt;&lt;br /&gt;The Arduino IDE can be downloaded from &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;this site.&lt;/a&gt;&lt;br /&gt;The SoftwareSerial library is used to enable Serial communication between the Arduino and the Nextion Enhanced display.     &lt;br /&gt;The &lt;a href=&quot;http://www.airspayce.com/mikem/arduino/AccelStepper/&quot;&gt;AccelStepper library&lt;/a&gt; is used to simplify the process of stepper motor control.     &lt;/div&gt;&lt;br /&gt;&amp;nbsp;    &lt;br /&gt;&amp;nbsp;       &lt;br /&gt;&lt;div id=&quot;Arduino Code&quot;&gt;&lt;br /&gt;&lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;&lt;br /&gt;Here is the Arduino Code for this project:&lt;br /&gt;&lt;script src=&quot;https://gist.github.com/ArduinoBasics/d6a449912684e8f4c96d3920fbc30e0a.js&quot;&gt;&lt;/script&gt;    &lt;/div&gt;&lt;div id=&quot;Arduino Code Description&quot;&gt;I set up a maximum and minimum speed for the motors, and some pre-defined keys.        It is possible to “tune” the motor using the first interface of the Nextion display.        You can do this by making the motor turn faster or slower until you reach the desired key.      &lt;br /&gt;I used the &lt;a href=&quot;https://itunes.apple.com/us/app/tuner-t1-free-tune-any-musical-instrument-guitar-ukulele/id453056916&quot;&gt;“Tuner T1 Free” app&lt;/a&gt; from the iTunes app store to identify WHEN the motor was producing a note in key.      &lt;br /&gt;When the motor was producing a specific note, I would write down the stepper motor speed that was printed to the Serial monitor window.        Every time the motor speed is increased or decreased, the Arduino code prints the speed to the serial monitor window.        I then use these speeds to update the notes[] array in the Arduino code.     &lt;br /&gt;The notes[] array holds the stepper motor speeds that correspond to the individual notes on the piano.        The Nextion display essentially sends the index number of the note to play from the notes array on the Arduino,        thereby simplifying the code required to spin the motor at 16 different speeds.     &lt;/div&gt;&lt;br /&gt;&amp;nbsp;    &lt;br /&gt;&amp;nbsp;       &lt;br /&gt;&lt;div id=&quot;Hooking it up&quot;&gt;&lt;br /&gt;&lt;h4&gt;Hooking it up:&lt;/h4&gt;&lt;br /&gt;With all boards powered off, the next step is to make all of the necessary hardware connections to the Arduino. There are two major sections to consider,     &lt;br /&gt;&lt;br /&gt;&lt;ol type=&quot;a&quot;&gt;&lt;li&gt;The Stepper motor driver and motor&lt;/li&gt;&lt;li&gt;The Nextion Enhanced board &lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;You need to ensure that you use an external power source to power both the stepper motor and the Nextion Enhanced board.       The stepper motor driver board itself was powered by the Arduino without any problems, but the actual stepper motor will need an external power supply.       The Nextion Enhanced board also needs an external power supply because it requires more current than the Arduino can safely provide.     &lt;br /&gt;Here is how you would connect the Arduino to the Stepper motor driver board and associated stepper motor.     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJDFr4W-NtqP3wK-JkRK9PuF-_sPT8_vCr3mqJ-HmbqZC8B__t0aW_sLMMEspa22LdRVHprjUdD1TRcjzgkjvq7EubxPyEWpkQL7nSeTkESIKAdnGQSXKjyYXRSLIduaWi4lNcPwmm_mM/s1600/Arduino+to+DuinoTech+L298_labelled.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Connecting up the stepper motor to the Arduino via a Stepper motor controller (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;716&quot; data-original-width=&quot;1600&quot; height=&quot;286&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJDFr4W-NtqP3wK-JkRK9PuF-_sPT8_vCr3mqJ-HmbqZC8B__t0aW_sLMMEspa22LdRVHprjUdD1TRcjzgkjvq7EubxPyEWpkQL7nSeTkESIKAdnGQSXKjyYXRSLIduaWi4lNcPwmm_mM/s640/Arduino+to+DuinoTech+L298_labelled.png&quot; title=&quot;Fritzing diagram of the connections between Arduino and Stepper Motor Controller and Stepper Motor&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhULc4k5jZwKWMldNSaTwGY7IIOaCAm_5HyJTJ_hxq4QN1EqSjhghbJGhCORSu7TFB45urkE5F_p6K04p63ROeGolnXIE5hwLlwzdOM1F25PYTljXD4VBjFZwKlvIRubdsLHYnqw_ckQ08/s1600/Arduino+to+Duinotech+L298+Connection+Table.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Connection Table showing connections between the Arduino and the Steppr motor via a Stepper motor controller (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;736&quot; data-original-width=&quot;522&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhULc4k5jZwKWMldNSaTwGY7IIOaCAm_5HyJTJ_hxq4QN1EqSjhghbJGhCORSu7TFB45urkE5F_p6K04p63ROeGolnXIE5hwLlwzdOM1F25PYTljXD4VBjFZwKlvIRubdsLHYnqw_ckQ08/s640/Arduino+to+Duinotech+L298+Connection+Table.png&quot; title=&quot;Connection Table for Arduino to Stepper Motor Controller and Stepper motor&quot; width=&quot;451&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrKZ-QWhsOp7peukRIIYdsEgHvndXIavVhY-srB5AIC0-BmyU3jWD-IILjOzy84DzWl-oELp7gAx2Xo6IjTbN2Qui7zxqJYHrJpuSaRHX7-8YOhk2hjetn7unmPf9THN1lpUpD0tsfCkc/s1600/Duinotech+L298.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Duinotech L298 module (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;526&quot; data-original-width=&quot;586&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrKZ-QWhsOp7peukRIIYdsEgHvndXIavVhY-srB5AIC0-BmyU3jWD-IILjOzy84DzWl-oELp7gAx2Xo6IjTbN2Qui7zxqJYHrJpuSaRHX7-8YOhk2hjetn7unmPf9THN1lpUpD0tsfCkc/s400/Duinotech+L298.png&quot; title=&quot;Duinotech L298 module&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;      &lt;br /&gt;&amp;nbsp;           &lt;br /&gt;And this is how you would connect the Arduino to the Nextion Enhanced display     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTtcxK-Uy-XBk7dLUR2EiLuVb7vtO3sT7VwgXtReNeA5zzqDuUVtuw_SaKqrZs20YlrDE7Mw2-3bBjqpzBLmyLOkAJnDL8TPIZ-DniGr27BB_NP1OAjPDUwtzhaC496VhKRgMiEM-xroA/s1600/Arduino+Nextion_labelled.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Diagram showing the connections between the Arduino and the Nextion Enhanced Module (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;414&quot; data-original-width=&quot;1600&quot; height=&quot;164&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTtcxK-Uy-XBk7dLUR2EiLuVb7vtO3sT7VwgXtReNeA5zzqDuUVtuw_SaKqrZs20YlrDE7Mw2-3bBjqpzBLmyLOkAJnDL8TPIZ-DniGr27BB_NP1OAjPDUwtzhaC496VhKRgMiEM-xroA/s640/Arduino+Nextion_labelled.png&quot; title=&quot;Fritzing diagram of Arduino to Nextion Enhanced Module&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMvLoRcecc1fexsSnIOW8aJ5-Xl7iAf0ie1VxslXQ2RtFzL-XHyf-cVyfyAZDvpzIIy8NzTRfrM6w_nhetI65vx1o2oWgdeBWNMJlrAt_f4xKU1qT2nntru0qYxWpLiN2urd7DmFCJxKM/s1600/Arduino+Nextion+Connection+Table.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Table that shows the connection between the Arduino UNO and the Nextion Enhanced NX4827K043 module&quot; border=&quot;0&quot; data-original-height=&quot;474&quot; data-original-width=&quot;770&quot; height=&quot;392&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMvLoRcecc1fexsSnIOW8aJ5-Xl7iAf0ie1VxslXQ2RtFzL-XHyf-cVyfyAZDvpzIIy8NzTRfrM6w_nhetI65vx1o2oWgdeBWNMJlrAt_f4xKU1qT2nntru0qYxWpLiN2urd7DmFCJxKM/s640/Arduino+Nextion+Connection+Table.png&quot; title=&quot;Arduino to Nextion Enhanced (NX4827K043) Connection Table&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJKgHxggpjdxppWtFXqaIAxRX2Lf-fce-ycBnZMjXFD5VkKpWP8wyFQDw2VuZh6qxDtm58gKB3yztKwEegxNac_kuQ_ra5BUBrssf8PcnnLiIZ7ZqtplwiIxkSBSfzUcFLk1Oirhyphenhyphen2FlU/s1600/Nextion+and+Expansion+board+with+transparent+background.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Nextion Enhanced module and Expansion Board (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;435&quot; data-original-width=&quot;1600&quot; height=&quot;171&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJKgHxggpjdxppWtFXqaIAxRX2Lf-fce-ycBnZMjXFD5VkKpWP8wyFQDw2VuZh6qxDtm58gKB3yztKwEegxNac_kuQ_ra5BUBrssf8PcnnLiIZ7ZqtplwiIxkSBSfzUcFLk1Oirhyphenhyphen2FlU/s640/Nextion+and+Expansion+board+with+transparent+background.png&quot; title=&quot;Nextion Enhanced module and Expansion Board&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;         &lt;br /&gt;&amp;nbsp;              &lt;br /&gt;And this is what it looked like when I put it all together:     &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjmuspA0MCapL0w6CsPgZWlVQFOXYDYLLmmL8CCj-nckMBHBlbV4YZ4gTtO7nnRb9Xja7vYeET3HCVWFXTTzqcwHINEIoNUfkvERi8u3wp3cF0NXIWjoStASbUnhS4SwVNrWZszssqYv4/s1600/Nextion+Enhanced+Stepper+Motor+Piano_labelled.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;All the connections required for the stepper motor piano project (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;662&quot; data-original-width=&quot;1600&quot; height=&quot;264&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjmuspA0MCapL0w6CsPgZWlVQFOXYDYLLmmL8CCj-nckMBHBlbV4YZ4gTtO7nnRb9Xja7vYeET3HCVWFXTTzqcwHINEIoNUfkvERi8u3wp3cF0NXIWjoStASbUnhS4SwVNrWZszssqYv4/s640/Nextion+Enhanced+Stepper+Motor+Piano_labelled.png&quot; title=&quot;Fritzing diagram showing all connections required for the Stepper Motor Piano Project&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuAVYC5jgTas35_bndPTB7MhqUSv7GryaRcgiHBVs-wAyWPlP1AfCEKKvKXJtImvQTPlvjSrswEJRL2p0LVnR0_V9o0pXM2xpOOFHXUfYuIL3uPTRSi9HdWbWFr4MlJmislnj0TAGisz4/s1600/Stepper+Piano+Completed+Project.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Picture showing the complete setup of the Nextion Enhanced Stepper motor piano project (arduinobasics.blogspot.com)&quot; border=&quot;0&quot; data-original-height=&quot;809&quot; data-original-width=&quot;1059&quot; height=&quot;488&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuAVYC5jgTas35_bndPTB7MhqUSv7GryaRcgiHBVs-wAyWPlP1AfCEKKvKXJtImvQTPlvjSrswEJRL2p0LVnR0_V9o0pXM2xpOOFHXUfYuIL3uPTRSi9HdWbWFr4MlJmislnj0TAGisz4/s640/Stepper+Piano+Completed+Project.jpg&quot; title=&quot;Picture showing the complete setup of the Nextion Enhanced Stepper motor piano project&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Make note of the external power supply used.       I made sure that I had a large enough power supply to handle the power requirements of the project,       and utilized the relevant datasheets to help me identify those requirements. If you plan to replicate this project,       make sure you take into consideration the specific power requirements of your motor, your motor driver and your Nextion display.       The Arduino can only supply 400mA of current from the 5V pin.     &lt;br /&gt;With everything hooked up, I powered up the Nextion display, then powered up the Arduino. The stepper motor starts spinning automatically.       I used the first interface to change the direction and/or speed of the motor. Please note the maximum and minimum speeds set up in the Arduino code.       &lt;br /&gt;I then used the Next button to jump to the second interface on the Nextion Enhanced display.         The second interface looks like a piano. And when I press a key on the piano display, the motor changes speed to match the note I pressed.     &lt;br /&gt;Voila !! The stepper motor piano is born !!     &lt;br /&gt;I played a number of simple tunes on the Stepper motor piano and was surprised how well it worked. Very clever !!     &lt;/div&gt;&lt;br /&gt;&amp;nbsp;   &lt;br /&gt;&amp;nbsp;       &lt;br /&gt;&lt;div id=&quot;Concluding comments&quot;&gt;&lt;br /&gt;&lt;h4&gt;Concluding comments&lt;/h4&gt;&lt;br /&gt;This project is relatively simple, but stepper motors can be tricky to set up and tune. Nothing a bit of determination cannot fix.     &lt;br /&gt;This project was a lot of fun. If you plan to replicate this project, I would be interested to see your versions, or just knowing if this helped you in any way.     &lt;br /&gt;&lt;br /&gt;&amp;nbsp;          &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://www.itead.cc/&quot;&gt;&lt;img alt=&quot;iTead Studio Logo&quot; border=&quot;0&quot; data-original-height=&quot;106&quot; data-original-width=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaQ4EJSEn0YZQSP6H9-VQHLJ7TVMTh8-31C_Bag-ijhHio4g85fvGhWI6Is-bIQohXcjvmU-upk1dmXVGu_0vduN7a-YgCvalFhx8j62nfPCDUPdR-Z-jk4nTC-f9QfpHBSyORV2ow05I/s1600/iTead+Studio+Logo.png&quot; title=&quot;iTead Studio Logo&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This project would not have been possible without the collaborative efforts of iTead Studio.         Their Nextion Enhanced display has a lot more to offer than what I have shown you here.         But hopefully this tutorial gives you some insight into the power of such a display, and perhaps how it could improve the project you are currently working on.          The only thing I did not like was the power requirements. I would have preferred something within Arduino power supply limits. Nevertheless, I am very happy with the Nextion Enhanced display,         and would recommend it to anyone looking for a Human Machine interface to include in their project.         You can see how simple it was to create TWO interfaces for my project, and I only scratched the surface.     &lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/6295304014052391401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2017/08/nextion-enhanced-stepper-motor-piano.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/6295304014052391401'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/6295304014052391401'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2017/08/nextion-enhanced-stepper-motor-piano.html' title='Nextion Enhanced Stepper Motor Piano Project'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/pNTjRYohDl8/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-360276155018562808</id><published>2017-03-27T13:08:00.000+07:00</published><updated>2018-03-28T22:35:13.341+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino compatible Open-source PLC"/><category scheme="http://www.blogger.com/atom/ns#" term="Cayenne"/><category scheme="http://www.blogger.com/atom/ns#" term="Controllino"/><category scheme="http://www.blogger.com/atom/ns#" term="IoT"/><category scheme="http://www.blogger.com/atom/ns#" term="OWI Robotic Arm"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Smartphone"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Hacking Robotic Arm using Controllino and Cayenne</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/qQ2g2e-OQFk?showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;      &lt;/div&gt;    &lt;/P&gt;  &lt;/div&gt;     &lt;br&gt; &amp;nbsp;         &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;H4&gt;Description&lt;/H4&gt;    &lt;/P&gt;    &lt;P&gt;      This tutorial will show you how to take over the controls of the OWI Robotic Arm with the help of an Arduino compatible, open-source PLC called the Controllino MAXI,        together with Cayenne (my go-to iOT application for remote connection to my Arduino projects).        The Controllino MAXI will provide the physical connections to the OWI robotic arm, and Cayenne will allow me to control the arm via my web browser        or via the Cayenne app on my phone.     &lt;/P&gt;  &lt;/div&gt;          &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;Parts Required:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;ul&gt;          &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/548&quot;&gt;OWI Robotic Arm&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://controllino.biz/product/controllino-maxi/&quot;&gt;Controllino MAXI - Arduino Compatible, open-source PLC&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://goo.gl/0lLUR7&quot;&gt;Free Cayenne Account&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.jaycar.com.au/2-1mm-dc-socket-with-screw-terminals/p/PA3713&quot;&gt;2.1mm DC Socket with Screw Terminals&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/1954&quot;&gt;Female to Male Jumper Wires&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/1311&quot;&gt;Solid Core wire&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;  &lt;/div&gt;          &lt;br&gt; &amp;nbsp;        &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Arduino Libraries and IDE&lt;/h4&gt;    &lt;/P&gt;    &lt;OL&gt;      &lt;li&gt;The Arduino IDE can be used to program the Controllino. You can dowload the Arduino IDE from here: &lt;a href=&quot;https://www.arduino.cc/en/main/software&quot;&gt;https://www.arduino.cc/en/main/software&lt;/a&gt;.     &lt;/li&gt;    &lt;li&gt;You will also need to read the &lt;a href=&quot;https://mydevices.com/cayenne/docs/#getting-started-arduino-arduino-setup-using-cayenne-arduino-library &quot;&gt;Cayenne Ethernet library installation instructions&lt;/a&gt; in order to install the Cayenne Ethernet Library.&lt;/li&gt;     &lt;li&gt;The Controllino will connect to the internet via the Ethernet port onboard.&lt;/li&gt;       &lt;li&gt;You do not need the Controllino library for this project, however, if you have a Controllino, you might as well install the library.       You can read the Controllino library installation instructions from their GitHub webpage here: &lt;a href=&quot;https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library&quot;&gt;https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library&lt;/a&gt;.       &lt;/li&gt;     &lt;li&gt;You will need to notify the Arduino IDE of the Controllino MAXI board by pasting the supplied URL into the &quot;Additional Boards Manager URLs&quot; in the Arduino IDE.&lt;/P&gt;      &lt;/li&gt;     &lt;li&gt;This is located under:  FILE - PREFERENCES - Additional Boards Manager URLs.       &lt;/li&gt;     &lt;li&gt;The URL that you need to paste is in &lt;a href=&quot;https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library&quot;&gt;STEP 3 &lt;/a&gt; of the Controllino Library installation instructions on their GitHub page.        &lt;/li&gt;     &lt;li&gt;The video at the top of this tutorial may help clarify the process.&lt;/li&gt;    &lt;/OL&gt;         &lt;/div&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;        &lt;div id=&quot;Arduino Code&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;script src=&quot;https://gist.github.com/ArduinoBasics/7b3c507cb2f608dad194cdc0564b1ff5.js&quot;&gt;&lt;/script&gt;    &lt;/P&gt;  &lt;/div&gt;        &lt;div id=&quot;Arduino Code Description&quot;&gt;    &lt;P&gt;      The code above is very simple, however you will need to create a dashboard of widgets from within your Cayenne account in order to control the OWI robotic Arm from your phone or via the Dashboard webpage.     &lt;/P&gt;  &lt;/div&gt;      &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;         &lt;div id=&quot;Hooking it up&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Setting up Cayenne Dashboard&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      Once you have created your Cayenne account, you will be presented with a webpage to choose a board to connect to. Controllino is an Arduino compatible PLC, so make sure to follow these instructions for setting up the Controllino in your Cayenne Account.       &lt;ol&gt;        &lt;li&gt;Select Arduino from the available list of boards. &lt;/li&gt;        &lt;li&gt;Make sure to install the necessary libraries if your have not done so already. &lt;/li&gt;        &lt;li&gt;Select Arduino MEGA from the avaliable list of Arduino boards &lt;/li&gt;        &lt;li&gt;Select Ethernet Shield W5100&lt;/li&gt;           &lt;li&gt;Copy and paste the Arduino code that pops up on screen into your Arduino IDE and upload to the Controllino. &lt;/li&gt;        &lt;li&gt;Alternatively, copy and paste the code from above, however you will need to insert your Authentication token to get it to work &lt;/li&gt;      &lt;/ol&gt;    &lt;/P&gt;    &lt;P&gt;      After you upload the code to the Controllino, and providing it has an ethernet cable connected to the internet router (and has access to the internet), and is powered on, it will connect       to your Cayenne Dashboard. You can now add widgets to the dashboard in real time to interact with the Controllino, and without uploading any more code to the open source PLC.     &lt;/P&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;          &lt;P&gt;&lt;h3&gt;Adding Widgets&lt;/h3&gt;&lt;/P&gt;    &lt;P&gt;      We need to add a number of widgets in order to activate the relays on the Controllino. The relavent digital pins that we will need to know about can be found on the Controllino website here:       &lt;a href=&quot;https://controllino.biz/downloads/&quot;&gt;https://controllino.biz/downloads/&lt;/a&gt;.        &lt;/P&gt;      &lt;P&gt;Here is the direct link to the &lt;a href=&quot;https://controllino.biz/wp-content/uploads/2016/02/CONTROLLINO-MAXI-PINOUT-09-02-16.pdf&quot;&gt;PINOUT file for the Controllino MAXI&lt;/a&gt;.     &lt;/P&gt;      &lt;P&gt;      &quot;Armed&quot; with that knowledge, we can now create the widgets which are necessary to control the relays on the Controllino. From within the Cayenne dashboard, please follow these instructions to create a widget:       &lt;ol&gt;          &lt;li&gt;Select - ADD NEW&lt;/li&gt;        &lt;li&gt;Select - DEVICE/WIDGET&lt;/li&gt;        &lt;li&gt;Select - ACTUATORS&lt;/li&gt;        &lt;li&gt;  Then - RELAY from the dropdown box&lt;/li&gt;        &lt;li&gt;Select - RELAY SWITCH&lt;/li&gt;        &lt;li&gt;Give the widget a descriptive name to differentiate it from the other widgets and a name that is somewhat informative (eg. R0 - Pos)&lt;/li&gt;        &lt;li&gt;I gave the first widget the name &quot;R0 - Pos&quot;, because it will connect to Relay R0, and that relay will be connected to the Positive (POS) terminal of the OWI robotic arm.         &lt;li&gt;Select the device you would like to connect to. Be aware that you can change the name of the device in the settings. If you followed this tutorial, it should have the             name &quot;Arduino MEGA&quot;, but I changed the name of the device to &quot;Controllino&quot; to be more accurate.&lt;/li&gt;        &lt;li&gt;We will be using a digital pin to control the relay, therefore select &quot;Digital&quot; as the Connectivity option&lt;/li&gt;        &lt;li&gt;For this specific widget, we will be controlling R0, which is activated by digital pin D22 on the Controllino. Therefore select &quot;D22&quot; from the &quot;Pin&quot; dropdown box.&lt;/li&gt;        &lt;li&gt;Choose a &quot;Button&quot; as the widget type&lt;/li&gt;           &lt;li&gt;Choose an icon from the dropdown box that makes sense to you&lt;/li&gt;        &lt;li&gt; Skip Step 1&lt;/li&gt;        &lt;li&gt; Select Step 2: Add actuator &lt;/li&gt;      &lt;/ol&gt;    &lt;/P&gt;    &lt;P&gt;      You should now see your new widget on the dashboard. Select the widget to enable or activate that relay. If you do this, and if everything goes to plan, you will see the LED for R0 illuminate on the Controllino.       You now have to add the rest of the widgets to the dashboard in order to control the rest of the relays on the Controllino.&lt;br&gt;      &lt;/P&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;           &lt;P&gt;&lt;h3&gt;Widget Dashboard&lt;/h3&gt;&lt;/P&gt;    &lt;P&gt;      Here is a table to show you how I setup my dashboard.     &lt;/P&gt;    &lt;P&gt;&lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqLsHU8c8xInpUN6hgfEKuWtXK-SSwnHplZfuxAO4UdTdsJz0uY39UzWQCGay-R80MJabsiZDiu6EnS1o6ZrAS6HIzIRUfPqBUStXVMgkMUddZMBC_eprfusPiO4lIrtpxVwdN2ySl39k/s640/Controllino+Cayenne+Connection+Table.png&quot; width=&quot;640&quot; /&gt;&lt;/P&gt;    &lt;P&gt;        &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;310&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCl9bDz6C44fZbiUUWR_TQVPz7zXj1Tpw2qLXZJp_DAqCEmO9ngjUFXiAzHCTp-zFyJ43QyLQ7x-76pJyJ7MfFA6enMJct3xnRwZi-r0Ax7-TSxZf08LeRZyR2J31eal8agEzyAb1PgqA/s640/Cayenne+Dashboard+with+Motor+Running+Pos.png&quot; width=&quot;640&quot; /&gt;    &lt;/P&gt;     &lt;br&gt; &amp;nbsp;      &lt;br&gt; &amp;nbsp;      &lt;br&gt; &amp;nbsp;           &lt;P&gt;      &lt;h3&gt;Fritzing diagram&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;508&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjVXIUPipWsd3Ta8-z2OwOOL4UTYE9mO5ylcIy74QKCDxd2pOtie7aZFeOm3ZPf1fp8cO5bLjH5yLMDchBuC1OjEqWMYWVUeoKxmxdXF-4wQAAO4wGBt9ZX5zHqcr1GS6dVuzXYm6A3Kk/s640/Controllino+MAXI+Fritzing+sketch+Edit1.png&quot; width=&quot;640&quot; /&gt;    &lt;/P&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;          &lt;P&gt;      &lt;h3&gt;OWI Robotic Arm Pins&lt;/h3&gt;    &lt;/P&gt;      &lt;P&gt;      &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;426&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXXInJzmFhLfj_km_3qxuby3sFVNUGg48roV6Otp0kVoW6UIgYdd12fkxOGgbuGLpJ9akX8lA-2lHOFZz1HqIYQDJ5ZTmLs2BB6lDaB3GY3TiMWd4w3yqYl5aJoPz1Mc8o4Qxu4ZotuUU/s640/OWI+Robotic+Arm+Fritzing+Pin+Connections+Sharpened+and+AB+logo.png&quot; width=&quot;640&quot; /&gt;    &lt;/P&gt;      &lt;P&gt;&lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;288&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge2m9vYNhL82e6AV_BVJjxS4K8_MNrd-zLhoqLx36VRucrtYCx5fNTTpCMsQBttlhivJEKVMFR1_HNxFLgV2uZcYK7mheFabtcsKjDyD87-rCeOzuwyOzAyoh3xKhEd6YPKhrEknG65Wk/s640/Robot+Arm+pins+exposed+with+labels.jpg&quot; width=&quot;640&quot; /&gt;    &lt;/P&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;           &lt;P&gt;      &lt;h3&gt;Normal OWI Robotic Arm Circuit&lt;/h3&gt;    &lt;/P&gt;      &lt;P&gt;      The following circuit diagram will show you how the wired control box is normally connected to the OWI Robotic arm. This is the circuit diagram of the OWI robotic arm under normal operating contidtions.     &lt;/P&gt;    &lt;P&gt;        &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc3kKLfTf7I9drnEEY03oFRXrx78WW8NpjyhfIJaxhQKJrGbE-FfSgNq3n1gkgHHvtlpWqddtB7dHPM3Ltd7COO8wB0edf-Of7OI2AtyNg812VR4KHqn4rhXgXPeEdRaKH52-nL5HR9uc/s640/OWI+ROBOTIC+ARM+CIRCUIT+DIAGRAM.png&quot; width=&quot;444&quot; /&gt;    &lt;/P&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;           &lt;P&gt;      &lt;h3&gt;OWI Robotic Arm Circuit when connected to Controllino&lt;/h3&gt;    &lt;/P&gt;      &lt;P&gt;      The following circuit diagram will show you how the OWI Robotic Arm will be controlled by the relays of the Controllino. This is the circuit diagram of the OWI robotic arm when it is connected to the Controllino.     &lt;/P&gt;    &lt;P&gt;        &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNaKkphFe8NGezHbH2i7ayebAUFJ4AzI_4xaMYYG6ziGLyhtyphjEaqVW5erRW2GSgKG7Z2n5bT8qaM8sErtnlIkARpW45bVBEpzukmYFI_d4a1YFJ6ens2akv8cqjxNAdysJkk866zJM/s640/OWI+Robot+Arm+with+Controllino+Circuit+Diagram.png&quot; width=&quot;446&quot; /&gt;    &lt;/P&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;     &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;&lt;h3&gt;All connected&lt;/h3&gt;&lt;/P&gt;    &lt;P&gt;The OWI Robotic Arm is connected to a breadboard using the female-to-male jumper wires. Solid core wire is then fed through to the relay terminals of the Controllino. You could     just wire it up so that the robotic arm is connected directly to the Controllino, however, I did not have the right connectors for this purpose.&lt;br&gt;    The Controllino is also connected to my internet router via a normal RJ-45 ethernet cable, and is powered by a 12V DC power adapter.&lt;/P&gt;    &lt;/div&gt;      &lt;P&gt;    &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;346&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXQ3gmVPuN8FfyJo9h4iQX4ObzJsb2ytChpqAPYDOyCMbQW2pExkTwHW3wGJjXWTGxEEyHVnhrYRz6F_2ES7yP2X2XYiqxwaBKxCgYcGROD4QkqPguAwFoqKSjTXowP17QT1MxBgwhw54/s640/Final+Setup+complete+project.jpg&quot; width=&quot;640&quot; /&gt;    &lt;/P&gt;  &lt;/div&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;        &lt;div id=&quot;Concluding comments&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Summary&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;!--Write concluding comments below--&gt;      Now that you have all the physical connections made, uploaded the code to the Controllino, and have created your dashboard in Cayenne, you should be able to control your OWI Robotic arm from       anywhere in the world. As demonstrated in the video at the start of this tutorial, the robotic arm has quite a bit of give on each of the joints, which makes it difficult to achieve       certain tasks that require an element of precision. There goes that idea of being able to perform surgery with this thing !!! At least you can get it to make you a cup of tea, and if you       are patient enough, you might even get a grape once in a while.     &lt;/P&gt;         &lt;P&gt; Thank you to &lt;a href=&quot;https://controllino.biz/&quot;&gt;Controllino&lt;/a&gt; and &lt;a href=&quot;https://goo.gl/0lLUR7&quot;&gt;Cayenne&lt;/a&gt; for making this tutorial possible. If you would like your product featured in my tutorials, please contact me on my &lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/contact-scottc.html&quot;&gt;contact page&lt;/a&gt;.   &lt;/div&gt;           &lt;br&gt; &amp;nbsp;    &lt;br&gt; &amp;nbsp;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;   &lt;P&gt;   &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZFBF3E75fZ8Ehl-hkljhYy5Ql2sRe_EKG_IV1Lh4Jdo4RhRrt0j-5PnnqKnHmQ_snaAJdMTA_YAhxfnP2GF693g8YUnYlXI0xq07kq15cDZVxNXa6AkRJe8m8TTyoT7uRtNkDgcjeCPw/s320/Controllino+Instagram.png&quot; width=&quot;318&quot; /&gt;   &lt;/P&gt;   &lt;/div&gt;  &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;         &lt;div align=&quot;center&quot;&gt;      If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;      &lt;br /&gt; &amp;nbsp;       &lt;br /&gt;      Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br /&gt;      Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br /&gt;      I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br /&gt;      Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.   &lt;/div&gt;        &lt;br /&gt;  &lt;div class=&quot;separator&quot; id=&quot;ArduinoBasics Project Page Link&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       &lt;a href=&quot;https://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;       &lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;  &lt;/div&gt;     </content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/360276155018562808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2017/03/hacking-robotic-arm-using-controllino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/360276155018562808'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/360276155018562808'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2017/03/hacking-robotic-arm-using-controllino.html' title='Hacking Robotic Arm using Controllino and Cayenne'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/qQ2g2e-OQFk/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-7511211973749046680</id><published>2017-03-13T09:01:00.000+07:00</published><updated>2018-03-28T22:35:13.443+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="433Mhz"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino Nano"/><category scheme="http://www.blogger.com/atom/ns#" term="CHAIN BLOCKS"/><category scheme="http://www.blogger.com/atom/ns#" term="DC Motor"/><category scheme="http://www.blogger.com/atom/ns#" term="Evaluation"/><category scheme="http://www.blogger.com/atom/ns#" term="HC-SR04"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Prextron"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Receiver"/><category scheme="http://www.blogger.com/atom/ns#" term="relay"/><category scheme="http://www.blogger.com/atom/ns#" term="Review"/><category scheme="http://www.blogger.com/atom/ns#" term="RF"/><category scheme="http://www.blogger.com/atom/ns#" term="RGB"/><category scheme="http://www.blogger.com/atom/ns#" term="Transmitter"/><category scheme="http://www.blogger.com/atom/ns#" term="Ultrasonic sensor"/><title type='text'>Prextron CHAIN BLOCKS - Arduino Nano controlled Ultrasonic sensor that switches a motor wirelessly using 433MHz RF modules and a relay board.</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/WeroFBG-ap4&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;      &lt;/div&gt;    &lt;/P&gt;    &lt;br&gt; &amp;nbsp;          &lt;P&gt;      &lt;H4&gt;Description&lt;/H4&gt;    &lt;/P&gt;    &lt;P&gt;      In this tutorial, I will be evaluating Prextron CHAIN blocks – a new system that allows you to connect your sensors and actuators to an Arduino NANO using clever 3D-printed prototyping boards that can be stacked sideways. This very modular system makes it easy to connect, disconnect and replace project components, and eliminate the “rats nest of wires” common to many advanced Arduino projects.       CHAIN BLOCKS are open, which means that you can incorporate any of your sensors or actuators to these prototyping boards, and you can decide which specific pin on Arduino you plan to use.        The CHAIN BLOCK connections prevent or reduce common connection mistakes, which make them ideal for class-room projects and learning activities.     &lt;/P&gt;    &lt;P&gt;        I am going to set up a project to put these CHAIN BLOCKs to the test:&lt;br&gt;        When I place my hand in-front of an Ultrasonic sensor, the Arduino will transmit a signal wirelessly to another Arduino, and consequently turn on a motor.     &lt;/P&gt;  &lt;/div&gt;  &lt;div&gt;    &lt;br&gt; &amp;nbsp;          &lt;P&gt;      &lt;h4&gt;Parts Required:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;&lt;b&gt;You need the following Prextron Chain Blocks&lt;/b&gt;&lt;br&gt;      &lt;ul&gt;                 &lt;li&gt;&lt;a href=&quot;https://www.prextron.com/shop&quot;&gt;Arduino Nano x2&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.prextron.com/shop&quot;&gt;433MHz RF Transmitter and Receiver modules&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.prextron.com/shop&quot;&gt;HC-SR04 Ultrasonic sensor&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.prextron.com/shop&quot;&gt;RGB LED module&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.prextron.com/shop&quot;&gt;Relay Module&lt;/a&gt;&lt;/li&gt;          &lt;br&gt;        You also need a few extra components:&lt;br&gt;        &lt;li&gt;DC motor&lt;/li&gt;        &lt;li&gt;9V battery&lt;/li&gt;        &lt;li&gt;9V battery adapter&lt;/li&gt;      &lt;/ul&gt;&lt;br&gt;      &lt;b&gt;Please note: You may need to solder the module wires to the CHAIN BLOCK protoboard.&lt;/b&gt;    &lt;/P&gt;  &lt;/div&gt;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgJhM68UsvlB3XWZjc9oXT6EJ16Jqst_8NsgkdEncOuOb9L-10fMCS3oxuSAOonxdG6TqDplLdEDlQ_kCmbwngU25_LQwuS3DS_3YGGujAuHMPtVGFjAs22DvtKsdEWJruzcm3-dOxf3o/s400/Colourful+Chain+Blocks.jpg&quot; width=&quot;400&quot; /&gt;  &lt;/div&gt;       &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;   &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Arduino Libraries and IDE&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;!--Write Arduino Library and IDE information below--&gt;      This project does not use any libraries. However, you will need to upload Arduino code to the Arduino.       For this you will need the Arduino IDE which can be obtained from the official Arduino website: &lt;br&gt;      &lt;a href=&quot;https://www.arduino.cc/en/main/software&quot;&gt;https://www.arduino.cc/en/main/software&lt;/a&gt;      &lt;/P&gt;  &lt;/div&gt;       &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;         &lt;div id=&quot;Arduino Code for Transmitter&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE: RF Transmitter&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;script src=&quot;https://gist.github.com/ArduinoBasics/d0e0613cc10542751ac6e9f8b3272ebd.js&quot;&gt;&lt;/script&gt;    &lt;/P&gt;  &lt;/div&gt;     &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;      &lt;div id=&quot;Arduino Code for Receiver&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE: RF Receiver&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;script src=&quot;https://gist.github.com/ArduinoBasics/2234f325af42984ae7489301da312a62.js&quot;&gt;&lt;/script&gt;    &lt;/P&gt;  &lt;/div&gt;     &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;      &lt;div id=&quot;Transmitter side&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Fritzing diagrams for Transmitter&lt;/h4&gt;    &lt;/P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; height=&quot;411&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEvdJ25Gjh9aeJdGS01f23nwQeg-f47mGEyZsaMLpvOOy8J6JXbBPezUc-uVKen10fuKuSn_kLNycyIwg7E7rOZ4gYoPThPtbgToZiegr6zp4nef-phNgRSBKBUKPE1-bRwlJLtNf1zbc/s640/Transmitter+Chain+Block+Fritzing_04.png&quot; width=&quot;640&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;           &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSAhYjqoI4MaH_tC-SfxrOBNfOIeEUeMxSEMLKVIlMgB2kMw_iZlF7II4-NvercNukSNqiXueOTcnBeBcrfZV3vPWFF2zNWJoK71TBIzguC4h9Ro6FZkZW5xhIFkmAWR57j99Vv2nSEWY/s400/G2.PNG&quot; width=&quot;500&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;           &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYrn__hLmPAjdEPBAUDaRaqUQ0q_1-89EdrV5fYUMdTRxGo9lX6PS46X5x0RW0U9NN0W8ao6Nhh4lX-1tbMfWutJq3pC4r-UB7VIA3cZfWeFZlxTNE53U4pmAJeEbWNFaVnaStZD4D9Ko/s1600/G3.PNG&quot; width=&quot;500&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWNu71jPneCW_PbR7o7DVeyG6pK8vdOK3aBtI27eEQFqNbAUwYKZ6krwMU42AuDPdb0T7pqaQiK4qUdtMNZlZ1MGGnrLx0M_O55vvIHl__50k3AZQ-WM_p7ZD21sLg4mXXswtutZqfiiM/s1600/G4.PNG&quot; width=&quot;500&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;        &lt;/div&gt;     &lt;br&gt; &amp;nbsp;          &lt;div id=&quot;Receiver side&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Fritzing diagrams for Receiver&lt;/h4&gt;    &lt;/P&gt;           &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJvvpsoqnR-z1O11dTdJAnweNnrQKvFyQhKwK6Vo38Q-uxNk-p4oaIC4vdrnI9DyalmMKyZlyuDY3UewsGPCnPmERgFXN23p6CX10Q9Hbm3qEIG91pl_-AKbvfL7XXLj5nOzbe_QoMLUg/s640/Receiver+Chain+Block+Fritzing_01.png&quot; width=&quot;640&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;         &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-ayKVv9JKUebjXcp3_Nm-ftq6ER6iaDkBXL88m2XMqY9uaSxjSLEzMKwa69vVt7zX0AaQkYAGr-f6LdluywpOSJYgWxVsmPqZnnR0iWpZZTiOkrvvX5XFCujL2XBXPc-A5UNWV2Dkm2Q/s400/H2.PNG&quot; width=&quot;500&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;           &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOm1Qizpa5rQNKs7M0bYlaEFmJr17iE8JGifwa2mWOmzAc_gISHN_FVimbuJvq7hZtdTweJ2fITUfNzYjQlXUoP5NiWCjR6nAAWhFE8_8t7lGS4rUfLryMsEDlyTR4lOQbcvYcWXiYryA/s1600/H3.PNG&quot; width=&quot;500&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;         &lt;img style=&quot;border: 3px double white;padding: 6px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzd6FZ9-5yYg-hDqKFMpTnDZUor3EzFNlgN1bjjXHx0ZPXA2_fL9X-ss4Mn4DrKEA3PO1QoZFtydmWEesTm0ygG5ICdvZoE2VoCdEho-O8esn_Omq96abLXfWjgbw5xFQkF_JcjRuxIRE/s400/H4.PNG&quot; width=&quot;500&quot; /&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt; &amp;nbsp;        &lt;/div&gt;        &lt;div id=&quot;Concluding comments&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Concluding comments&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      The purpose of this project was to evaluate Prextron CHAIN BLOCKs and put them to the test. Here is what I thought of CHAIN BLOCKS at the time of evaluation.       Some of my points mentioned below may no longer apply to the current product. It may have evolved / improved since then. So please take that into consideration     &lt;/P&gt;    &lt;br&gt; &amp;nbsp;           &lt;h3&gt;What I liked about Chain Blocks&lt;/h3&gt;      &lt;div style=&quot;text-align: justify;&quot;&gt;      &lt;P&gt;        &lt;ul&gt;         &lt;li&gt;The design is simple, the product is simple. &lt;/li&gt;         &lt;li&gt;Once the Chain Blocks were all assembled, they were very easy to connect to each other.&lt;/li&gt;         &lt;li&gt;I can really see the benefit of Chain Blocks in a teaching environment, because it simplifies the connection process, and reduces connection mixups.&lt;/li&gt;         &lt;li&gt;It was good to see that the blocks come in different colours, which means that you can set up different colour schemes for different types of modules.&lt;/li&gt;         &lt;li&gt;You can incorporate pretty much any sensor or Actuator into the Chain block which is very appealing.&lt;/li&gt;           &lt;li&gt;You also have the flexibility of choosing which pins you plan to use on the Arduino.&lt;/li&gt;         &lt;li&gt;Projects look a lot neater, because you no longer have the rats nest of wires.&lt;/li&gt;           &lt;li&gt;The Blocks lock into each other which means that they are much easier to transport/carry.&lt;/li&gt;           &lt;/ul&gt;      &lt;/P&gt;             &lt;br&gt; &amp;nbsp;            &lt;/div style=&quot;text-align: justify;&quot;&gt;    &lt;h3&gt;What I did not like about Chain Blocks&lt;/h3&gt;      &lt;div&gt;      &lt;P&gt;        &lt;ul&gt;         &lt;li&gt;In most cases, the Chain Block protoboard lanes were not numbered, which increased the chances of making mistakes when soldering &lt;/li&gt;         &lt;li&gt;The need to solder modules to the protoboard, may be a discouragement for some people.&lt;/li&gt;         &lt;li&gt;I would have liked a choice of different size Chain blocks. Some of the sensors did not fit nicely into the Square blocks.&lt;/li&gt;         &lt;li&gt;Prextron really need to work on their website if they plan to get serious with this product: Webpage has incomplete functionality or irrelevant links etc etc.&lt;/li&gt;         &lt;/ul&gt;      &lt;/P&gt;    &lt;/div&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;   &lt;div&gt;    &lt;P&gt;Thank you very much to Prextron for providing the CHAIN BLOCKS used in this tutorial, and allowing me to try out their product.          If you are interested in trying them yourself, then make sure to visit them at: &lt;br&gt;         &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://www.prextron.com&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwdQ6muXLYJymraB89Kk6ELGMjWAbcGlTuoi0I-92M35qDbe7UfmlCVzwb3DvWnBBieMhkote3g4cnIcVjWG4uxcOhByyil1VqDtgy9kwcjcN3eZAXCTIKOgkkoWxSrTuBuMn9Vy78TSk/s400/L1.PNG&quot; width=&quot;400&quot; height=&quot;225&quot; /&gt;&lt;/a&gt;&lt;/div&gt;    &lt;/P&gt;  &lt;/div&gt;        &lt;br&gt; &amp;nbsp;    &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;               &lt;div align=&quot;center&quot;&gt;      If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;      &lt;br /&gt; &amp;nbsp;       &lt;br /&gt;      Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br /&gt;      Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br /&gt;      I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br /&gt;      Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.   &lt;/div&gt;        &lt;br /&gt;  &lt;div class=&quot;separator&quot; id=&quot;ArduinoBasics Project Page Link&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       &lt;a href=&quot;https://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;       &lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;  &lt;/div&gt;             </content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/7511211973749046680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2017/03/prextron-chain-blocks-arduino-nano.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7511211973749046680'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7511211973749046680'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2017/03/prextron-chain-blocks-arduino-nano.html' title='Prextron CHAIN BLOCKS - Arduino Nano controlled Ultrasonic sensor that switches a motor wirelessly using 433MHz RF modules and a relay board.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/WeroFBG-ap4/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-7043045415001490823</id><published>2016-12-06T17:14:00.000+07:00</published><updated>2018-03-28T22:35:13.545+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Cayenne"/><category scheme="http://www.blogger.com/atom/ns#" term="Garage Door Monitor"/><category scheme="http://www.blogger.com/atom/ns#" term="GY-80"/><category scheme="http://www.blogger.com/atom/ns#" term="HMC5883L"/><category scheme="http://www.blogger.com/atom/ns#" term="Home Automation"/><category scheme="http://www.blogger.com/atom/ns#" term="IoT"/><category scheme="http://www.blogger.com/atom/ns#" term="Seeeduino Cloud"/><title type='text'>Garage Door Monitor with Cayenne</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/VeKXYH4D-0A?showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;      &lt;/div&gt;    &lt;/P&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt;     &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;H4&gt;Description&lt;/H4&gt;    &lt;/P&gt;    &lt;P&gt;      Using the HMC5883L magnetometer sensor of the GY-80 module from ICStation to monitor a garage door and notify when it has been opened or closed.       The Cayenne service provides much of the monitoring and notifying functionality. A major feature of this project. Cayenne takes care of all of the complicated work behind the scenes,       making it easy to connect your Arduino to the cloud and allow you to monitor your garage from virtually anywhere.&lt;br&gt; &amp;nbsp;       &lt;br&gt;             This project was created specifically to monitor a garage, but you will soon discover that this project could be used to monitor a whole host of other things.       Monitor your front door, your back door, your bag, your chair, your cookie jar. &lt;br&gt; &amp;nbsp;       &lt;br&gt;      Monitor for peace of mind, or catch someone in the act of stealing your stuff.  This project has got you covered. Let&#39;s see how:            &lt;/P&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt;  &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;Parts Required:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;ul&gt;           &lt;li&gt;&lt;a href=&quot;http://goo.gl/0lLUR7&quot;&gt;Cayenne IoT for Arduino - free Account&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/Seeeduino-Cloud-Arduino-Yun-compatible-openWRT-controller-p-2123.html&quot;&gt;Seeeduino Cloud (or Arduino Yun)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=1646&quot;&gt;GY-80 sensor module&lt;/a&gt;&lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Freetronics-ProtoShield-Basic-for-Arduino-p/ard-1011.htm&quot;&gt;Protoboard&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Mini-Breadboard-4-5cmx3-5cm-p/str122c2m.htm&quot;&gt;Mini-Breadboard 4.5cm x 3.5cm&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Solderless-Breadboard-Jumper-Wire-Kit-p/cab-1008.htm&quot;&gt;Jumper Wires&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.gizmodo.com.au/2015/05/the-best-portable-batteries-you-can-buy-in-australia/&quot;&gt;Power bank (11000mAh)&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;  &lt;/div&gt;    &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;          &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;HMC5883L DataSheet:&lt;/h4&gt;      &lt;/P&gt;    &lt;P&gt;You can find the datasheet for the HMC5883L pretty easily by searching on the internet. &lt;br&gt;          &lt;a href=&quot;http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Magneto/HMC5883L-FDS.pdf&quot;&gt;HMC5883L datasheet - Sparkfun&lt;/a&gt;    &lt;/P&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;      &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;Arduino Libraries and IDE&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      Here is a link to the &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE download&lt;/a&gt;. The IDE is required to upload code to the Seeeduino Cloud.     &lt;/P&gt;    &lt;P&gt;      You need the Cayenne Library installed in your Arduino IDE. &lt;br&gt;You can find the Cayenne library here: &lt;br&gt;      &lt;b&gt;&lt;a href=&quot;http://www.cayenne-mydevices.com/docs/#using-cayenne-library&quot;&gt;Cayenne Libarary&lt;/a&gt;&lt;/b&gt; &lt;br&gt; &amp;nbsp;       &lt;br&gt;         There are libraries on the internet for the GY-80 module, however, it is relatively easy to use the magnetometer on this module. And therefore no libraries are required for the sensor.       If you would like some more information about using the magnetometer sensor, and how to get the most out of it, then please have a look at &lt;a href=&quot;http://arduinobasics.blogspot.com.au/2016/11/hmc5883l-on-gy-80-module.html&quot;&gt;my previous tutorial&lt;/a&gt; which goes into much more detail.     &lt;/P&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt;     &lt;div id=&quot;Arduino Code&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;script src=&quot;https://gist.github.com/ArduinoBasics/458a92b96c6e67c0fbefc0a0da82dfa6.js&quot;&gt;&lt;/script&gt;    &lt;/P&gt;  &lt;/div&gt;       &lt;br&gt; &amp;nbsp;        &lt;div id=&quot;Arduino Code Description&quot;&gt;    &lt;P&gt;      You need to make sure to insert your OWN Cayenne token into the sketch above. You will get this token when connecting your Arduino to the Cayenne service.        &lt;a href=&quot;https://youtu.be/VeKXYH4D-0A?t=439&quot;&gt;Watch the video&lt;/a&gt; for further explanation.     &lt;/P&gt;  &lt;/div&gt;    &lt;br&gt; &amp;nbsp;   &lt;br&gt;            &lt;div style=&quot;text-align: justify;&quot;&gt;       &lt;P&gt;      &lt;h4&gt;Fritzing diagram&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5E92aXHkMpHewTxnsOUdjAcij-oMnK0lYkdstdtHs5HsxfvHiwidlGYWh8GfFpqDlktIKfUw7lf5qAtsFmUNVBT6WzdwNFTLI5XA1WKP-V3EX65apUWERS21RSh-9THhhpCT7B4gk3c/s1600/GY80+with+Yun_bb.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5E92aXHkMpHewTxnsOUdjAcij-oMnK0lYkdstdtHs5HsxfvHiwidlGYWh8GfFpqDlktIKfUw7lf5qAtsFmUNVBT6WzdwNFTLI5XA1WKP-V3EX65apUWERS21RSh-9THhhpCT7B4gk3c/s640/GY80+with+Yun_bb.png&quot; width=&quot;640&quot; height=&quot;574&quot; /&gt;&lt;/a&gt;&lt;/div&gt;    &lt;/P&gt;         &lt;P&gt;      &lt;h4&gt;Cayenne Widgets&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      Please make sure to &lt;a href=&quot;https://youtu.be/VeKXYH4D-0A?t=429&quot;&gt;watch the video&lt;/a&gt; to see how to connect the Seeeduino Cloud to Cayenne and how to create the Cayenne widgets.       Cayenne widgets are necessary to create the dashboard on your phone or browser.       They will also interact with the Arduino sketch, and will also be involved in creating the notification system.         The following links will take you to the relevant part of the video:        &lt;P&gt;      &lt;UL&gt;      &lt;LI&gt;&lt;a href=&quot;https://youtu.be/VeKXYH4D-0A?t=520&quot;&gt;Master Switch Button&lt;/a&gt;&lt;/LI&gt;        &lt;LI&gt;&lt;a href=&quot;https://youtu.be/VeKXYH4D-0A?t=610&quot;&gt;Request Calibration Button&lt;/a&gt;&lt;/LI&gt;      &lt;LI&gt;&lt;a href=&quot;https://youtu.be/VeKXYH4D-0A?t=689&quot;&gt;x, y, and z Axis display&lt;/a&gt;&lt;/LI&gt;      &lt;LI&gt;&lt;a href=&quot;https://youtu.be/VeKXYH4D-0A?t=809&quot;&gt;Door Status&lt;/a&gt;&lt;/LI&gt;      &lt;LI&gt;&lt;a href=&quot;https://youtu.be/VeKXYH4D-0A?t=1010&quot;&gt;Creating a notification trigger&lt;/a&gt;&lt;/LI&gt;      &lt;/UL&gt;&lt;/P&gt;    &lt;/P&gt;      &lt;P&gt;The Master switch button is used to switch monitoring from OFF to ON (and vice versa). Therefore you can choose when to monitor the garage and when to stop monitoring.        When first installing the project onto your garage door, and turning the Seeeduino Cloud on, it will automatically calibrate each sensor to a value of 1000.        &lt;br&gt; &amp;nbsp;        &lt;br&gt;          If you experience any drift away from 1000 for whatever reason, simply press the Request calibration button, and each sensor will be recalibrated back to 1000.        The x,y and z axis widgets are there so that you can see the readings coming from the magnetometer sensor. And when any of the axis variables breach the threshold         away from 1000, it will trigger the Door Status widget.  This is how we can tell if the door is open or closed.         &lt;br&gt; &amp;nbsp;        &lt;br&gt;         We also use the Door Status widget to help with the notification system.        When the Door status changes from &quot;Closed&quot; to &quot;Open&quot;, a notification trigger will be activated, and a message will be sent via email or SMS.        This notification is useful for monitoring when the door was opened. If you happen to recalibrate when the door is open. You will get a notification when the garage door closes.&lt;/P&gt;           &lt;/div&gt;      &lt;br&gt; &amp;nbsp;    &lt;br&gt;        &lt;div id=&quot;Concluding comments&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Concluding comments&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      This project is relatively simple, and quite easy to set up. What I liked about this project was the versatility and alternate uses. You can use the same setup to monitor many       different things. It is not just limited to monitoring a garage door. But being able to tell whether my garage door is opened or closed, especially after I have driven away from my house       , is really cool. Now I don&#39;t have to drive all the way back home to check.       Let me know if you have replicated this project, and also what kinds of things you decided to monitor with this project.     &lt;/P&gt;  &lt;/div&gt;                 </content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/7043045415001490823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2016/12/garage-door-monitor-with-cayenne.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7043045415001490823'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7043045415001490823'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2016/12/garage-door-monitor-with-cayenne.html' title='Garage Door Monitor with Cayenne'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/VeKXYH4D-0A/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-220314382763271233</id><published>2016-11-06T23:20:00.000+07:00</published><updated>2018-03-28T22:35:13.647+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="GY-80"/><category scheme="http://www.blogger.com/atom/ns#" term="HMC5883L"/><category scheme="http://www.blogger.com/atom/ns#" term="ICStation"/><category scheme="http://www.blogger.com/atom/ns#" term="Magnetometer"/><category scheme="http://www.blogger.com/atom/ns#" term="Sensor"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>HMC5883L on the GY-80 module</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/tkPE6mJ0YFw?showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;      &lt;/div&gt;    &lt;/P&gt;  &lt;/div&gt;     &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;H4&gt;Description&lt;/H4&gt;    &lt;/P&gt;    &lt;P&gt;      In this tutorial, I will show you how to configure and extract data from the magnetometer (HMC5883L) sensor on the GY-80 10DOF module from ICStation.       While there are some very good libraries on the internet which will give you full access to this sensor, I will show you what you need to know without using a library.       This means that it may get a bit technical at times, but I will hold your hand along the way and provide explanations as required.       I would also recommend that you watch the complete video from start to finish - as the video provides really useful information.      &lt;/P&gt;  &lt;/div&gt;     &lt;br&gt; &amp;nbsp;        &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;Parts Required:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;ul&gt;        &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=3746&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=1646&quot;&gt;GY-80 10DOF Module&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;  &lt;/div&gt;  &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;HMC5883L Magnetometer Datasheet:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;You can find the datasheet for the HMC5883L pretty easily by searching on the internet. Here are a couple of sources:       &lt;ul&gt;        &lt;li&gt;&lt;a href=&quot;https://cdn-shop.adafruit.com/datasheets/HMC5883L_3-Axis_Digital_Compass_IC.pdf&quot;&gt;HMC5883L - Adafruit&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Magneto/HMC5883L-FDS.pdf&quot;&gt;HMC5883L - Sparkfun&lt;/a&gt;&lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.jameco.com/Jameco/Products/ProdDS/2150248.pdf&quot;&gt;HMC5883L - Jameco&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;          &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Arduino Libraries&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      This tutorial does not use any external libraries.&lt;br&gt;      It does use the Wire library for I2C communication.&lt;br&gt;        However, there is no extra download required to access the Wire library.&lt;br&gt;      If you are looking for a library specific for the HMC5883L sensor, then I would recommend one of these:       &lt;ul&gt;        &lt;li&gt;&lt;a href=&quot;https://github.com/jarzebski/Arduino-HMC5883L&quot;&gt;HMC5883L library- jarzebski&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/HMC5883L&quot;&gt;HMC5883L library - jrowberg&lt;/a&gt;&lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;https://github.com/adafruit/Adafruit_Sensor&quot;&gt;HMC5883L library - Adafruit&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;    &lt;P&gt;Like I said - you do not need an HMC5883L library for this tutorial. The libraries above are listed for those who wish to learn more about this particular sensor.&lt;/P&gt;    &lt;P&gt;&lt;h4&gt;Arduino IDE&lt;/h4&gt;&lt;/P&gt;    &lt;P&gt;The Arduino IDE can be downloaded from the Arduino website. Visit the &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE download page.&lt;/a&gt;&lt;/P&gt;    &lt;P&gt;I generally use the ZIP file for Windows and never seem to have any issues.&lt;br&gt;       There are downloads available for all the major operating systems.&lt;/P&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;      &lt;div id=&quot;Arduino Code&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;I have created a Gist for the Arduino code to configure and extract data from the HMC5883L sensor.      However, I also have a &lt;a href=&quot;https://github.com/ArduinoBasics/ICStation_Products/tree/master/1.%20GY-80&quot;&gt;GitHub repository&lt;/a&gt; which aims to capture the code for all of the sensors on the GY-80 module.     Code for the other sensors will become available in due time. Meanwhile, have a look at the code below for the HMC5883L sensor: &lt;/P&gt;    &lt;P&gt;      &lt;script src=&quot;https://gist.github.com/ArduinoBasics/4067eddc5ab2340444610cb1c256f294.js&quot;&gt;&lt;/script&gt;    &lt;/P&gt;  &lt;/div&gt;     &lt;div id=&quot;Arduino Code Description&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      This code will set all axis values to 1000 upon startup. Moving the GY-80 module around will result in a value greater or less than 1000, however, returning the sensor back to it&#39;s original position, should result in values very close to 1000 on each axis.       I chose to introduce this calibration in order to avoid negative values, and I liked the fact that I could set a heading with values that were easy to remember.&lt;br&gt; &amp;nbsp;       &lt;br&gt;      The magSetting function was created to easily configure the magnetometer. &lt;br&gt;      Make sure to look at the &lt;a href=&quot;https://www.youtube.com/watch?v=tkPE6mJ0YFw&quot;&gt;video&lt;/a&gt; and also the datasheet for further information about calibrating the magnetometer.&lt;br&gt; &amp;nbsp;       &lt;br&gt;      The getReadings function was created to easily retrieve the magnetometer axis data. I chose to use Single measurement mode in this tutorial.     &lt;/P&gt;  &lt;/div&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;      &lt;div id=&quot;Hooking it up&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Hooking it up:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      You can communicate with any of the sensors on the GY-80 module using I2C. The HMC5883L magnetometer sensor is no different.        You will need four connections between the Arduino UNO and the GY-80 module. Have a look at the diagram below for the connection diagram and table.     &lt;/P&gt;    &lt;P&gt;      &lt;h3&gt;Fritzing diagram&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY4O04zy0K1TyUYPQnrnzuChnvu4-BXgyAb5uQ6wiZRHUohJRb6lyr1eojMpsovT3KBI7ES8z_SdqtO0-KTWSbBcxzI79pfeEqPu-7itzp9elItufrBXgf0SPNRwBL9Inp0c8hrKoHAmM/s1600/7E.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY4O04zy0K1TyUYPQnrnzuChnvu4-BXgyAb5uQ6wiZRHUohJRb6lyr1eojMpsovT3KBI7ES8z_SdqtO0-KTWSbBcxzI79pfeEqPu-7itzp9elItufrBXgf0SPNRwBL9Inp0c8hrKoHAmM/s640/7E.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;        &lt;br /&gt;    &lt;/P&gt;    &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp;          &lt;P&gt;&lt;h4&gt;Project pictures&lt;/h4&gt;&lt;/P&gt;    &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitObcT_ZOxKOzDQzsMrn_L5heq5g8smto4hMo4LaF0KKMHZnxSEj1y9zSoEj0TeyLJCotjwkfTaFzg_cjSzkfB5fk6pn_k90_XZVQ7-vO4CPyy5jmtJz5IGkbZVc6M4-olgosU6BPRKSU/s1600/1AB.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;386&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitObcT_ZOxKOzDQzsMrn_L5heq5g8smto4hMo4LaF0KKMHZnxSEj1y9zSoEj0TeyLJCotjwkfTaFzg_cjSzkfB5fk6pn_k90_XZVQ7-vO4CPyy5jmtJz5IGkbZVc6M4-olgosU6BPRKSU/s640/1AB.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh8XFSkskfglrtAKSAgRtNnXhFI6uAWmer8S34Mdbtg57vhjl3zLev9iZFSy0hIOAQvTQbga2Oxzq7YgcoJ9d5ZNf4YkgiR0j8WtA6ScxehbEewLuQlN_Aul5sYuu48n5xjl-hTSsOjAE/s1600/1AC.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh8XFSkskfglrtAKSAgRtNnXhFI6uAWmer8S34Mdbtg57vhjl3zLev9iZFSy0hIOAQvTQbga2Oxzq7YgcoJ9d5ZNf4YkgiR0j8WtA6ScxehbEewLuQlN_Aul5sYuu48n5xjl-hTSsOjAE/s640/1AC.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA5RMtFmib0vyLC_4sDD389QZyAEddKUByHPdapg7KSxurDb1dAek8NM2ogxNyzHp-TDXiQXWcBYepWo9wGbZ2_-_aaKCNsAgyCTeAvElfHavTsQVMA1fZKdKsLzpPqUM2JbgMSVLnLKc/s1600/4B.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA5RMtFmib0vyLC_4sDD389QZyAEddKUByHPdapg7KSxurDb1dAek8NM2ogxNyzHp-TDXiQXWcBYepWo9wGbZ2_-_aaKCNsAgyCTeAvElfHavTsQVMA1fZKdKsLzpPqUM2JbgMSVLnLKc/s640/4B.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpG5zrTKEhuleTi9mfBclrpZcNnogdhqo-XKz82B8EEHvsxMF_UpewWrZ8enEMZh2I8kBV-D72GHUZoN1oy-Gi6wHdAzN5zhiprpqT8hp3cOfaW63gI35c-T_arWUnRtPd8o9PTB7JEhM/s1600/7J.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpG5zrTKEhuleTi9mfBclrpZcNnogdhqo-XKz82B8EEHvsxMF_UpewWrZ8enEMZh2I8kBV-D72GHUZoN1oy-Gi6wHdAzN5zhiprpqT8hp3cOfaW63gI35c-T_arWUnRtPd8o9PTB7JEhM/s640/7J.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV6XW4qBe-9jkFBtk4MF3MzretKDcStubyVbBmNSy71f8wNwYolDTMDXHIqJ9fE5GqplNCFrVY3Q-Zm21ejboCwXWm1iynVIYqmrarP3F2TkeuE7XpYsJLCMwv4tPA7f1X_MBHu7Tyqjs/s1600/7AE.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV6XW4qBe-9jkFBtk4MF3MzretKDcStubyVbBmNSy71f8wNwYolDTMDXHIqJ9fE5GqplNCFrVY3Q-Zm21ejboCwXWm1iynVIYqmrarP3F2TkeuE7XpYsJLCMwv4tPA7f1X_MBHu7Tyqjs/s640/7AE.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgynV0af0JisLFEtfzQIpnQ7rfSpQPTVQhTxoQDPZvKaSM4JXX_quULwiDekxRxC6mbOLxKf6gCwue0B6xt-Xc_aoQAeyQoOEfnzfl0uGtAjP7bw48yeSWkVmpqKYxfiAJ-tGwWZ9dae4g/s1600/8CS.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgynV0af0JisLFEtfzQIpnQ7rfSpQPTVQhTxoQDPZvKaSM4JXX_quULwiDekxRxC6mbOLxKf6gCwue0B6xt-Xc_aoQAeyQoOEfnzfl0uGtAjP7bw48yeSWkVmpqKYxfiAJ-tGwWZ9dae4g/s640/8CS.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxOYBQdQqjLyLEEFgIebfywKiOv1FgotT0iwZlV2hted9iAeh1pP23GQIZpBgCVGxAEZ7oXnXMLyJnAv22_8ghoWjTYKWiDPI5Pec_FqlUdztkotZDoY4SglxDl039ovfjHYq2O2r55cY/s1600/9AG.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxOYBQdQqjLyLEEFgIebfywKiOv1FgotT0iwZlV2hted9iAeh1pP23GQIZpBgCVGxAEZ7oXnXMLyJnAv22_8ghoWjTYKWiDPI5Pec_FqlUdztkotZDoY4SglxDl039ovfjHYq2O2r55cY/s640/9AG.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXT75fDgBSATukdzKwEo4X4d260lRZ3gUHxTNY30rTIhqgfLT_R80Pz9Z_mZTzYnpJtLIrhzEEjz1PL48o2ALZXsGwYUY6Cxuq6O0K88yrJZWJPOrTIMd-25yyk1Luq3g8Rt9C-_F9FBg/s1600/10AE.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXT75fDgBSATukdzKwEo4X4d260lRZ3gUHxTNY30rTIhqgfLT_R80Pz9Z_mZTzYnpJtLIrhzEEjz1PL48o2ALZXsGwYUY6Cxuq6O0K88yrJZWJPOrTIMd-25yyk1Luq3g8Rt9C-_F9FBg/s640/10AE.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQUb4HVMySf4_ZQjsqt5qjyv8HfJ_MQ6ZOdwxHT9ra7CBcqjecXvomLC3SILcG4U6Pwfu8e0oapz2uugRlw1wFPayHrhFJvgCK6V6Kr-vHa46S-gqm9qOpKNbIFJhLomVV8bSxbUdRSh8/s1600/13AFB.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQUb4HVMySf4_ZQjsqt5qjyv8HfJ_MQ6ZOdwxHT9ra7CBcqjecXvomLC3SILcG4U6Pwfu8e0oapz2uugRlw1wFPayHrhFJvgCK6V6Kr-vHa46S-gqm9qOpKNbIFJhLomVV8bSxbUdRSh8/s640/13AFB.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguw5ueAyRF4dk8cj13EhZyzHZtfCWKzTTjWRaJaw70ZCSB-yUgZQX_GHTiqQfCN0QFieo1f6AZx7m1k518jP65o67g1W1cs0vyRIGvRxtLhfiYdqFn7RRa8LdAnlM62Qsw0ROgVDJvRiA/s1600/14AF.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguw5ueAyRF4dk8cj13EhZyzHZtfCWKzTTjWRaJaw70ZCSB-yUgZQX_GHTiqQfCN0QFieo1f6AZx7m1k518jP65o67g1W1cs0vyRIGvRxtLhfiYdqFn7RRa8LdAnlM62Qsw0ROgVDJvRiA/s640/14AF.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMy5dDhSv9CrMaIx72yz2iZRorNI4pr9pJp2XYXCLGAg-_1M7ULWoF3nzCs8wJnZ7ftT98kA0BiPXXxDFiriM_n-qYxeXSb_3p_TBc2K8nz8lULc2mvUYk0eTPrb8UeZjcbHoBcL8GE6o/s1600/14AG.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMy5dDhSv9CrMaIx72yz2iZRorNI4pr9pJp2XYXCLGAg-_1M7ULWoF3nzCs8wJnZ7ftT98kA0BiPXXxDFiriM_n-qYxeXSb_3p_TBc2K8nz8lULc2mvUYk0eTPrb8UeZjcbHoBcL8GE6o/s640/14AG.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;             &lt;/P&gt;  &lt;/div&gt;     &lt;div id=&quot;Concluding comments&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Concluding comments&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      The HMC5883L sensor on the GY-80 module is quite interesting and works relatively well.       There are a number of other sensors on the GY-80 module which can provide complementary positional data.        At some point, I plan to come back and explain some of the other sensors on this module,        but first I would like to create a real-life project using the magnetometer. So stay tuned.       You may want to subscribe to my social networks or to this blog to be notified of that project when I complete it.      &lt;/P&gt;    &lt;P&gt;I would like to thank ICStation for their collaborative efforts. Their contribution was invaluable to this tutorial&#39;s existence.&lt;/P&gt;  &lt;/div&gt;               &lt;div align=&quot;center&quot;&gt;      If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;      &lt;br /&gt; &amp;nbsp;       &lt;br /&gt;      Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br /&gt;      Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br /&gt;      I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br /&gt;      Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.   &lt;/div&gt;        &lt;br /&gt;  &lt;div class=&quot;separator&quot; id=&quot;ArduinoBasics Project Page Link&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;       &lt;a href=&quot;https://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;       &lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;  &lt;/div&gt;           </content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/220314382763271233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2016/11/hmc5883l-on-gy-80-module.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/220314382763271233'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/220314382763271233'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2016/11/hmc5883l-on-gy-80-module.html' title='HMC5883L on the GY-80 module'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/tkPE6mJ0YFw/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-2005582172903384793</id><published>2016-10-29T08:58:00.000+07:00</published><updated>2018-03-28T22:35:13.749+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="433Mhz"/><category scheme="http://www.blogger.com/atom/ns#" term="EspoTek Labrador"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Review"/><category scheme="http://www.blogger.com/atom/ns#" term="Speaker"/><title type='text'>EspoTek Labrador Review</title><content type='html'>&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Have you heard about the EspoTek Labrador ?&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A tiny board which can turn your computer into an&lt;br /&gt;- Oscilloscope&lt;br /&gt;- Waveform generator&lt;br /&gt;- Logic analyser&lt;br /&gt;- Multimeter&lt;br /&gt;- and Power supply.&lt;br /&gt;&lt;br /&gt;Great for makers or hobbyists with limited bench space or limited funds. Perfect for students and anyone starting out in the field of electronics&lt;br /&gt;&lt;br /&gt;As you will see in the video below, I take a prototype of the EspoTek Labrador for a spin, and try out all of the functions that this board can provide.&lt;br /&gt;&lt;br /&gt;I use an Arduino UNO, a couple of 433MHz RF modules, some LEDs and a speaker to see just how useful this board will be for my hobby requirements.&lt;br /&gt;&lt;br /&gt;I have been wanting an Oscilloscope for quite some time, and while this board does not necessarily win against a benchtop oscilloscope on a side-by-side comparison of specifications, it does make up for it somewhat in terms of price, space (or footprint), usability, and wide range of functionality. But does it actually function as an oscilliscope? Is it useful ? Will it do what I need it to do? &amp;nbsp;Or will I still need to buy that expensive oscilloscope that I have been saving up for?&lt;br /&gt;&lt;br /&gt;Have a look at my review below, and tell me what you think.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/7xwFEvJxv40?showinfo=0&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Let me know your thoughts in the comments below:</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/2005582172903384793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2016/10/espotek-labrador-review.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/2005582172903384793'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/2005582172903384793'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2016/10/espotek-labrador-review.html' title='EspoTek Labrador Review'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/7xwFEvJxv40/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-3614121831015475945</id><published>2016-09-11T13:09:00.000+07:00</published><updated>2018-03-28T22:35:13.844+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="EasyEDA"/><category scheme="http://www.blogger.com/atom/ns#" term="Guest Project"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Nano"/><category scheme="http://www.blogger.com/atom/ns#" term="PCB"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="RGB"/><category scheme="http://www.blogger.com/atom/ns#" term="RGB5050"/><category scheme="http://www.blogger.com/atom/ns#" term="Scroll Bar"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>EasyEDA RGB5050 LED Scroll Bar</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div&gt;  &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;         &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR3Vj4sRchhQSUHrb2e-aappPZl1_bPAhNalZzVugfMS0cDP2o-hVtRhDM49lrW9vHxSkA1rJY50NdaNC0lAEqdnLHQo_p-gTT8lII9juoepItQTTkfn_Z1Jkv30bP7IDcQtbV0XqlM50/s1600/Slide1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR3Vj4sRchhQSUHrb2e-aappPZl1_bPAhNalZzVugfMS0cDP2o-hVtRhDM49lrW9vHxSkA1rJY50NdaNC0lAEqdnLHQo_p-gTT8lII9juoepItQTTkfn_Z1Jkv30bP7IDcQtbV0XqlM50/s640/Slide1.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;  &lt;/P&gt;  &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;  &lt;P&gt;     &lt;H4&gt;Guest Post Disclaimer&lt;/H4&gt;  &lt;/P&gt;  &lt;P&gt;This is a guest post by the &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt; team. I would like to thank EasyEDA for providing this tutorial for everyone to enjoy.   All information within this post was provided by EasyEDA.&lt;/P&gt;&lt;/div&gt;   &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt; &lt;div&gt;  &lt;P&gt;    &lt;H4&gt;Description&lt;/H4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;div style=&quot;text-align: justify;&quot;&gt;      None of us could deny the fact that we would love with to play with LED’s and lighting stuff.        I love to play with LED’s and create attractive lighting effects.        This project was a result of such an attempt where I created a stunning RGB light effect using the popular development platform Arduino Nano.        Let’s see the circuit, code and instruction on building this project:      &lt;/div&gt;  &lt;/P&gt;&lt;/div&gt;   &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt; &lt;div&gt;  &lt;P&gt;    &lt;h4&gt;Parts Required:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;ul&gt;      &lt;li&gt;&lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;An EasyEDA account (free)&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;&quot;&gt;Arduino Nano (or compatible board)&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;&quot;&gt;LED strip&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Dupont wire connectors&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Custom control board&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt;  &lt;/P&gt;&lt;/div&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDF0u02sKoYUQliIqAg2y4PGkM7tCQSChvVwZOD4hvp43EvtGhS6YUVYX1zpUG2po3o0OGcSaAErA2P70hLDUziS_wnbo-gMzRaivPVCU19qNpk2ZzqcT2i-AL8e6mx_rMOXnSgTtSopc/s1600/image003.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDF0u02sKoYUQliIqAg2y4PGkM7tCQSChvVwZOD4hvp43EvtGhS6YUVYX1zpUG2po3o0OGcSaAErA2P70hLDUziS_wnbo-gMzRaivPVCU19qNpk2ZzqcT2i-AL8e6mx_rMOXnSgTtSopc/s400/image003.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;  &lt;/div&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;     &lt;/div&gt;      &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;    &lt;div&gt;  &lt;P&gt;    &lt;h4&gt;Arduino Libraries and IDE&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    No libraries are required for this project.     The Arduino IDE can be downloaded from the Arduino website.     Here is the &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;download link&lt;/a&gt;.   &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Arduino Code&quot;&gt;  &lt;P&gt;    &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;script src=&quot;https://gist.github.com/ArduinoBasics/f142f1ad0e5d3083010c48f25ef0d180.js&quot;&gt;&lt;/script&gt;  &lt;/P&gt;&lt;/div&gt;   &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt; &lt;div id=&quot;Hooking it up&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Preparing the LED strips&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;      &lt;div style=&quot;text-align: justify;&quot;&gt;        Cut down the LED strips into 10 single pieces.          Make sure you cut them into equal halves and make sure that only the copper conduction plate in the strip is cut.          Making a wrong cut disrupts the electrical conductivity between the LED’s.          After cutting down into separate strips, you will need to connect each strip using a Dupont wire connectors.        &lt;/div&gt;  &lt;/P&gt;     &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisbPmjdO_V_2QOgbHdilu0c8-2b90ZGkAfCahM6n8NDnnW0ETcfgRpxYMCbe7OplDHctGwwxaU4AGEcciDBcWTILGMTgTZX-PwIF1_uzE1HMTfVIL-xpf0DppZ8a_rkfN-rfKl4TRvQa0/s1600/image005.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisbPmjdO_V_2QOgbHdilu0c8-2b90ZGkAfCahM6n8NDnnW0ETcfgRpxYMCbe7OplDHctGwwxaU4AGEcciDBcWTILGMTgTZX-PwIF1_uzE1HMTfVIL-xpf0DppZ8a_rkfN-rfKl4TRvQa0/s400/image005.jpg&quot; width=&quot;388&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;         &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I/&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;        &lt;/div&gt;  &lt;/P&gt;    &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;  &lt;P&gt;    &lt;h4&gt;Designing the Control Board&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    I have made a custom control board that incorporates an Arduino Nano.      The control board is used to boost the incoming signal from Arduino and lights up the corresponding LED strips.   &lt;/P&gt;    &amp;nbsp;&lt;br&gt;    &lt;P&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBcpamV491rPy5O4v5kWa2WX1RBF1psX5CmoBUo8IOBOVR0yQluHpKDLyUfKhRuj6Jbt7RgKyaCMxW1UnJymZu_pMv1UEpqEtcedwE1eV-Xn7uJtkNkr8Ss0HbZnMpgXyv_BFqhRzyYEw/s1600/image006.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBcpamV491rPy5O4v5kWa2WX1RBF1psX5CmoBUo8IOBOVR0yQluHpKDLyUfKhRuj6Jbt7RgKyaCMxW1UnJymZu_pMv1UEpqEtcedwE1eV-Xn7uJtkNkr8Ss0HbZnMpgXyv_BFqhRzyYEw/s400/image006.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;    &lt;/div&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;     &lt;/div&gt;  &lt;/P&gt;     &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;  &lt;P&gt;    &lt;h4&gt;Control Board Circuit diagram&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;div style=&quot;text-align: justify;&quot;&gt;      I used a free Online circuit and PCB designing platform called &lt;a href=&quot;https://easyeda.com/&quot;&gt;&lt;b&gt;EasyEDA&lt;/b&gt;&lt;/a&gt; to develop my control board.        It is pretty easy to use especially because of the large library of parts to choose from. Once the design is complete, you have the option to order it through EasyEDA.        They offers great prices on custom PCB manufacturing.       I have added 10 connection points for 10 LED strips.        Each RGB LED strip is controlled by one of the Arduino Nano digital pins..        Transistors Q1,Q2,Q3….Q10 act as a switch for these LED strips for controlling 12V strips via a 5V signal from the Arduino.        And switches S1,S2..S4 were added to be able to select the effect on the strip.        The schematic can be seen below:      &lt;/div&gt;  &lt;/P&gt;        &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;        &lt;P&gt;&lt;h4&gt;Schematic&lt;/h4&gt;&lt;/P&gt;  You can access the actual EasyEDA schematic by clicking on the image below:   &lt;P&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;         &lt;a href=&quot;https://easyeda.com/editor#id=0FR3fdNmW&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ_x5aVOEn7abO7t5ybrRUFCcfLIOhxXgvmPvqJ97lRG7XyK0AvpQkyawtcH9DVsZ0ujKE0WJGAZSt0rNGqer6-P1qMhI8Fopex-emO_FG6p8BrdskM0_e1vsrqzv0miy2CggWrWg6q0s/s640/RGB5050+schematic.png&quot; width=&quot;620&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;&lt;/P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;      &lt;/div&gt;           &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;     &lt;P&gt;&lt;h4&gt;PCB Board Design&lt;/h4&gt;&lt;/P&gt;    &lt;P&gt;Here is the PCB board design for this project. &lt;br&gt; You can access the actual EasyEDA design by clicking on the image below.  &lt;/P&gt;  &lt;P&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;           &lt;a href=&quot;https://easyeda.com/editor#id=0FR3fdNmW|XnTbtnFXf&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;350&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEXfI0_FgcALmDxxDRCER8Ijwb_ZuldYeN-uYNhwyWCQNNqGmj0db4_kzpAIG_bgugpAAmLHi31Q5HqSmGlr22YMjFH4lj4oHiVYFn1PpTIQO43SgBB8SMBhMPGlnmkjqmVvNz1OFAfsA/s640/RGB5050-PCB+layout.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;       &lt;/div&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;           &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;         &lt;/div&gt;  &lt;/P&gt;      &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;     &lt;P&gt;&lt;h4&gt;PCB Fabrication&lt;/h4&gt;&lt;/P&gt;  &lt;P&gt;After completing the PCB design, you can click on the &lt;a href=&quot;https://easyeda.com/order&quot;&gt;Fabrication icon.&lt;/a&gt; &lt;/P&gt;      &lt;P&gt;You will then have access to the PCB order page which will allow you to download your PCB Gerber files that can be sent to any manufacturer.      However it is a lot easier (and cheaper) to order it directly from EasyEDA. &lt;br&gt;     Here you can select:        &lt;ul&gt;        &lt;li&gt;the number of PCBs you want to order &lt;/li&gt;        &lt;li&gt;the number of copper layers you need&lt;/li&gt;        &lt;li&gt;the PCB thickness&lt;/li&gt;        &lt;li&gt;copper weight&lt;/li&gt;        &lt;li&gt;and even the PCB color&lt;/li&gt;      &lt;/ul&gt;      After you’ve selected all of the options, click “Save to Cart” and complete you order.       You will then get your PCBs shipped a few days later.    &lt;/P&gt;    &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnlu76X2eQt0_PTzXswT2PAtDzovxhuCdAnv8VX33KBgSFa4EO2mOCPa1TgNMbfeLYJEV-gSEgNKaOmvBAslu1V-8fBK6bTmEVDhxV95-lY-TgT9msOg2gYP8KQ_39JsIDZYGHp-Z64Es/s1600/image012.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnlu76X2eQt0_PTzXswT2PAtDzovxhuCdAnv8VX33KBgSFa4EO2mOCPa1TgNMbfeLYJEV-gSEgNKaOmvBAslu1V-8fBK6bTmEVDhxV95-lY-TgT9msOg2gYP8KQ_39JsIDZYGHp-Z64Es/s640/image012.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;        &lt;/div&gt;  &lt;/P&gt;     &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;     &lt;P&gt;&lt;h4&gt;PCB final product&lt;/h4&gt;&lt;/P&gt;  &lt;P&gt;When I received the PCBs, I am quite impressed with the quality, they are pretty nice.&lt;/P&gt;    &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;         &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC1gnIfYl5Jnuzw-erfAiYOsb1M4iZhY_4BwsXZHILFT_oTPFvodbbHZdB852RyiWvoza2A14UsKK_iLzW2vdmyDPUKZi4i8ihuCSW8WdkrAQizwaDufV2PY1uJ9sSn9CmpyqSZCq9l98/s1600/image013.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC1gnIfYl5Jnuzw-erfAiYOsb1M4iZhY_4BwsXZHILFT_oTPFvodbbHZdB852RyiWvoza2A14UsKK_iLzW2vdmyDPUKZi4i8ihuCSW8WdkrAQizwaDufV2PY1uJ9sSn9CmpyqSZCq9l98/s400/image013.png&quot; width=&quot;385&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;        &lt;/div&gt;  &lt;/P&gt;      &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;     &lt;P&gt;&lt;h4&gt;PCB Build of Materials&lt;/h4&gt;&lt;/P&gt;  &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCERhl2cUWeAqrEz2ZU3zzYPtyzQlyyOQ0O2Y-j7BJs5GspdHGgOATKK0EFF97CRQImvdKDgQDV4hKMRCy5z0ARuy84xuXRICCWXlea0lX99YYgDtij_N0aZIM26_Q05iPnddlNK98mco/s1600/EasyEDA+BOM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;308&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCERhl2cUWeAqrEz2ZU3zzYPtyzQlyyOQ0O2Y-j7BJs5GspdHGgOATKK0EFF97CRQImvdKDgQDV4hKMRCy5z0ARuy84xuXRICCWXlea0lX99YYgDtij_N0aZIM26_Q05iPnddlNK98mco/s640/EasyEDA+BOM.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;  &lt;/P&gt;      &lt;P&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxuQfZkM08wHTbLzLa8NU3yGJjDlcGrPJatoHZ4kHtrahi6r7szmRNJ9IuKOmXiJIGzaSJ8Xg6pZBLBTno-2oqrgc3EUzNQ1cLtvllQ7SF5oJVa7WCC-3Daf1qoBsbIUgc_msC1qYmW5k/s1600/2+Plain+PCB+with+components+spread+around+it.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxuQfZkM08wHTbLzLa8NU3yGJjDlcGrPJatoHZ4kHtrahi6r7szmRNJ9IuKOmXiJIGzaSJ8Xg6pZBLBTno-2oqrgc3EUzNQ1cLtvllQ7SF5oJVa7WCC-3Daf1qoBsbIUgc_msC1qYmW5k/s400/2+Plain+PCB+with+components+spread+around+it.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;   &lt;/div&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;     &lt;/div&gt;  &lt;/P&gt;         &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;     &lt;P&gt;&lt;h4&gt;PCB connections&lt;/h4&gt;&lt;/P&gt;    &lt;P&gt;    &lt;div style=&quot;text-align: justify;&quot;&gt;       Connect the LED strips through the connection points in the board.         Make sure that you connect these correctly (push the connectors all the way onto the pin), because the chances of a short increase significantly with the number of wires connected.         Once all the connections are done all that left is to install your Arduino Nano (pre-programmed with the Arduino code above), and to power the PCB with a 12V power supply.     &lt;/div&gt;  &lt;/P&gt;     &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;       &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHCaSm_Pav-GlS1ea387c-Y7STXj4yxfLfwiX5uAvM7RIXerBajO2kRI65G5Pr0PymMzwcJ2pJt2xBNWQqcTX3u5c84zPTbJPZ2STQcnol01HjeNj6D0NOYBS4NObVrtFYsijEP7DIj4s/s1600/1+Completed+board+with+annotations.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;386&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHCaSm_Pav-GlS1ea387c-Y7STXj4yxfLfwiX5uAvM7RIXerBajO2kRI65G5Pr0PymMzwcJ2pJt2xBNWQqcTX3u5c84zPTbJPZ2STQcnol01HjeNj6D0NOYBS4NObVrtFYsijEP7DIj4s/s640/1+Completed+board+with+annotations.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;    &lt;/div&gt;&lt;br /&gt;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;       &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIxdCho9vqTrq13HIktiF8ojz7g9Z-o6AwzmN42fpBD3vNdq8aPdrrzAjh-Z4tetFweaVKdy_r-J1_TSGWtPxBzXxUKwxqAevMC8VALpFaVL77Jq1tVdfDriCcyQPxFDSY554HbXWAwi4/s1600/4+PCB+soldered+underneath+view.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIxdCho9vqTrq13HIktiF8ojz7g9Z-o6AwzmN42fpBD3vNdq8aPdrrzAjh-Z4tetFweaVKdy_r-J1_TSGWtPxBzXxUKwxqAevMC8VALpFaVL77Jq1tVdfDriCcyQPxFDSY554HbXWAwi4/s400/4+PCB+soldered+underneath+view.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;   &lt;/div&gt;&lt;br /&gt;  &lt;/P&gt;      &lt;P&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9G-jTA2G6YvyVKzTU9hmWOMAGAAjpJzFiOigjgntZvfICRFaX2PI5JUNtPxUO7lS4SLk6F4qsHN1tJLIuIYsx_s6y5WDBsxL09tXbmSbG3I3ZKdOlz6JrOqxQ5xLfXA7KAoo-YggA9no/s1600/image015.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9G-jTA2G6YvyVKzTU9hmWOMAGAAjpJzFiOigjgntZvfICRFaX2PI5JUNtPxUO7lS4SLk6F4qsHN1tJLIuIYsx_s6y5WDBsxL09tXbmSbG3I3ZKdOlz6JrOqxQ5xLfXA7KAoo-YggA9no/s640/image015.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;  &lt;/P&gt;  &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;  &lt;P&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1BkdHNXXvqYdXdmcRHK8lcfCUvAfkIeJdZSUjpZYuT6wMNiULmtcpGXyMiiOVLwCtKGJ6jaFLWC0OigOlU1e879xmAL0gJsSlvO__4rJU5evJ8Zfw9b_rj1GE6xGusD5w4jeThMtnsCw/s1600/LED+Scroll+Bar-GIF.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1BkdHNXXvqYdXdmcRHK8lcfCUvAfkIeJdZSUjpZYuT6wMNiULmtcpGXyMiiOVLwCtKGJ6jaFLWC0OigOlU1e879xmAL0gJsSlvO__4rJU5evJ8Zfw9b_rj1GE6xGusD5w4jeThMtnsCw/s640/LED+Scroll+Bar-GIF.gif&quot; width=&quot;640&quot; height=&quot;358&quot; /&gt;&lt;/a&gt;      &lt;/div&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;         &lt;P&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Image source: &lt;a href=&quot;https://easyeda.com/&quot;&gt;EasyEDA&lt;/a&gt;&lt;/span&gt;&lt;/P&gt;        &lt;/div&gt;  &lt;/P&gt;     &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt;        &lt;P&gt;&lt;h4&gt;Project Video&lt;/h4&gt;&lt;/P&gt;  &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/DyKyKZSim1U?showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;    &lt;/div&gt;  &lt;/P&gt;   &lt;/div&gt;   &amp;nbsp;&lt;br&gt;  &amp;nbsp;&lt;br&gt; &lt;div id=&quot;Concluding comments&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Concluding comments&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    Hope you like this RGB light effects project, do try it out and post your feedback below. &lt;br&gt;    &amp;nbsp; &lt;br&gt;         &lt;b&gt;Disclaimer:&lt;/b&gt;&lt;br&gt; This is a guest blog post by the EasyEDA team. All information within this post was provided by &lt;a href=&quot;https://goo.gl/rQC57I&quot;&gt;EasyEDA&lt;/a&gt;.   &lt;/P&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/3614121831015475945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2016/09/easyeda-rgb5050-led-scroll-bar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/3614121831015475945'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/3614121831015475945'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2016/09/easyeda-rgb5050-led-scroll-bar.html' title='EasyEDA RGB5050 LED Scroll Bar'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR3Vj4sRchhQSUHrb2e-aappPZl1_bPAhNalZzVugfMS0cDP2o-hVtRhDM49lrW9vHxSkA1rJY50NdaNC0lAEqdnLHQo_p-gTT8lII9juoepItQTTkfn_Z1Jkv30bP7IDcQtbV0XqlM50/s72-c/Slide1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-5216646627805152630</id><published>2016-09-02T11:11:00.000+07:00</published><updated>2018-03-28T22:35:13.950+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Alarm"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="Cayenne"/><category scheme="http://www.blogger.com/atom/ns#" term="Laser"/><category scheme="http://www.blogger.com/atom/ns#" term="MP3"/><category scheme="http://www.blogger.com/atom/ns#" term="myDevices"/><category scheme="http://www.blogger.com/atom/ns#" term="PIR"/><category scheme="http://www.blogger.com/atom/ns#" term="RFID"/><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><category scheme="http://www.blogger.com/atom/ns#" term="SMS"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Arduino based Security Project Using Cayenne</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;      &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijXNqv886x_sCTJiyY3Ib4jl1hWpzFPY8yBIYZ40tDl64wsDxuLvKfOZNL77_bvg8FDY6hT8GUYEJaYiUz6_lxbKCqsL58eLyWDmmwnqZsxLQfouVtzFbkKNhSvrt0lLbHPkRfsy1eZh0/s1600/Slide19.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijXNqv886x_sCTJiyY3Ib4jl1hWpzFPY8yBIYZ40tDl64wsDxuLvKfOZNL77_bvg8FDY6hT8GUYEJaYiUz6_lxbKCqsL58eLyWDmmwnqZsxLQfouVtzFbkKNhSvrt0lLbHPkRfsy1eZh0/s640/Slide19.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;    &lt;/P&gt;      &lt;/div&gt;        &lt;br&gt;    &amp;nbsp; &lt;br&gt;       &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;H4&gt;Description&lt;/H4&gt;    &lt;/P&gt;    &lt;P&gt;      This is an Arduino based home security project that uses the power of &quot;Cayenne&quot; for extraordinary capabilities.      &lt;/P&gt;      &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Cayenne Beta&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;      Cayenne is a new IoT drag and drop platform originally released for the Raspberry Pi, but now available for Arduino. Cayenne makes the task of connecting your Arduino to the internet       as simple as possible. All of the complexity of internet connectivity is hidden within the Cayenne library.&lt;/P&gt;         &lt;P&gt;You can easily create a Network of Arduinos and build an IoT system which       can be managed and operated within the Cayenne dashboard. This dashboard is accessible through your browser or via the Cayenne smart phone app (on IOS or Android). &lt;/P&gt;           &lt;P&gt;The feature I liked the most, was the ability to change the position of sensors or actuators on the Arduino without having to re-upload Arduino code. I could manage the changed position from within the Cayenne platform.          The other feature that I liked was the ability to setup actions based on custom triggers. You can use Cayenne to trigger a whole range of functions, for example: play a sound, move a motor, light up an LED, or to send alert notifications       via email or SMS.       &lt;/P&gt;       &lt;P&gt;      Cayenne is in Beta at the moment, so there are a few minor bugs here and there, but overall - I give it a thumbs up - it is definitely worth checking out.&lt;br&gt;      &amp;nbsp; &lt;br&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      Here is a link to the Cayenne Beta Program:&lt;br&gt;      &lt;a href=&quot;http://goo.gl/0lLUR7&quot;&gt;**Cayenne Beta Link**&lt;/a&gt;&lt;br&gt;      &lt;/div&gt;    &lt;/P&gt;    &lt;br&gt;         &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJoPmGXYAQgxa_3IdjsN_RS73oHjO72XkDLMfN7Ah8VnToFWyf-qWL72oVZCZllPQ_ZzekL7lv2UkrqnkglU1ubmExhqj_bvguU340Tw_gpJvS2Rb1uraA-05_d_OtuSbEspF7P0ckzEk/s1600/myDevices_IoT_Platform.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJoPmGXYAQgxa_3IdjsN_RS73oHjO72XkDLMfN7Ah8VnToFWyf-qWL72oVZCZllPQ_ZzekL7lv2UkrqnkglU1ubmExhqj_bvguU340Tw_gpJvS2Rb1uraA-05_d_OtuSbEspF7P0ckzEk/s640/myDevices_IoT_Platform.png&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;&lt;/div&gt;      &lt;br /&gt;         &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;font-size: x-small;&quot;&gt;Source:  &lt;a href=&quot;http://press.mydevices.com/myDevices_Press_Kit.zip&quot;&gt;myDevices Media Kit &lt;/a&gt;&lt;/span&gt;    &lt;/P&gt;         &amp;nbsp; &lt;br&gt;           &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Home Security Project Summary&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;         In order to fully experience this new IoT platform, I decided to create a project to really put it through its paces. This is what my Security Project will need:&lt;br&gt;      &lt;OL&gt;             &lt;li&gt;It will use two Arduinos, one connected to the internet via an Ethernet shield, and the other via WIFI.&lt;/li&gt;          &lt;li&gt;Two detectors - a PIR sensor and a laser trip wire. &lt;/li&gt;          &lt;li&gt;If the sensors are tripped, the person has 10 seconds to present an RFID tag to the Grove RFID reader:                &lt;ul&gt;                &lt;li&gt;If a valid RFID tag is SUCCESSFULLY presented within the time limit,  a nice personalised greeting will be played to that person using a Grove - Serial MP3 player&lt;/li&gt;                &lt;li&gt;If a valid RFID FAILS to be presented within the time limit, an Alarm will sound, and I will be notified of the intrusion via an SMS alert.&lt;/li&gt;              &lt;/ul&gt;          &lt;/li&gt;            &lt;li&gt;The Cayenne dashboard will show the status of the sensors, and I will have full control over my security system via the web interface (or smartphone app). &lt;/li&gt;            &lt;li&gt;The sensors will be attached to a different Arduino to that of the Grove MP3 player and the RFID tag reader, which means that there will have to be some level of           communication between the two Arduinos. In fact, the cross communication will be vital to the success of this project. &lt;/li&gt;      &lt;/OL&gt;    &lt;/P&gt;          &lt;br&gt;    &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;      &lt;P&gt;      &lt;h4&gt;Project Video&lt;/h4&gt;&lt;br&gt;          &lt;P&gt;            &lt;div style=&quot;text-align: center;&quot;&gt;               &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/EDsCsPLqVGI?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;           &lt;/div&gt;         &lt;/P&gt;   &lt;/P&gt;           &lt;/div&gt;&lt;br&gt;  &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;     &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Parts Required:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;ul&gt;        &lt;li&gt;&lt;a href=&quot;http://goo.gl/0lLUR7&quot;&gt;Cayenne IoT for Arduino - free account&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/Arduino-Uno-Rev3-p-694.html&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/Seeeduino-Cloud-Arduino-Yun-compatible-openWRT-controller-p-2123.html&quot;&gt;Seeeduino Cloud (or compatible board - eg. Arduino Yun)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/depot/grove-base-shield-p-754.html&quot;&gt;Grove Base Shield v1.2&lt;/a&gt;&lt;/li&gt;            &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/Grove-Serial-MP3-Player-p-1542.html&quot;&gt;Grove - Serial MP3 Player&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/Grove-125KHz-RFID-Reader-p-1008.html&quot;&gt;Grove - 125KHz RFID Reader&lt;/a&gt;&lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/5mW-Laser-Module-emitter-Red-Line-p-123.html&quot;&gt;5mW Laser Module emitter - Red Line&lt;/a&gt;&lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.ebay.com.au/itm/20PCS-GL5516-5516-Light-Dependent-Resistor-LDR-5MM-Photoresistor-For-Arduino-/391140641229&quot;&gt;Light Dependent Resistor(LDR) 5MM&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/PIR-Motion-Sensor-p/sen-1003.htm&quot;&gt;PIR Motion sensor (HC-SR501)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Mixed-Color-and-Size-LED-Kit-p/led-1001.htm&quot;&gt;LED and 330ohm resistor&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Mini-Breadboard-4-5cmx3-5cm-p/str122c2m.htm&quot;&gt;Mini Breadboard 4.5cm x 3.5cm&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Solderless-Breadboard-Jumper-Wire-Kit-p/cab-1008.htm&quot;&gt;Breadboard jumper Wire&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;  &lt;/div&gt;         &lt;br&gt;    &amp;nbsp; &lt;br&gt;       &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Flow Diagrams:&lt;/h4&gt;    &lt;/P&gt;        &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Main Flow Diagram&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;     The following flow diagram shows the Security project process. It is a high level view of the decisions being made by each Arduino in response to various events.      &amp;nbsp; &lt;br&gt;    &lt;P&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtKZvS0FSnOfYaZ7iqYYl71tmAEx5GuZ7ozjjCSMLHtIz-WwCq7QmPdGSDRvn3gt4nEjEs8aO4337KwxJ3-HrxcMX_x8gVcbhTz7ja0Ozs8paztzerdMWAONajVqbM_tNGP8oB1fLtLrY/s1600/MainFlow.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtKZvS0FSnOfYaZ7iqYYl71tmAEx5GuZ7ozjjCSMLHtIz-WwCq7QmPdGSDRvn3gt4nEjEs8aO4337KwxJ3-HrxcMX_x8gVcbhTz7ja0Ozs8paztzerdMWAONajVqbM_tNGP8oB1fLtLrY/s640/MainFlow.jpg&quot; width=&quot;295&quot; /&gt;&lt;/a&gt;&lt;/div&gt;                &lt;br&gt;    &amp;nbsp; &lt;br&gt;    &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Triggers Flow Diagram&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;      The following flow diagram aims to highlight the various triggers set up within Cayenne to get this Security system to work.      &amp;nbsp; &lt;br&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9MfkVZrJiLEa6dEbCOJ0qOztNn8tNI-35gKyUfDowQNshaqO3NsBkvrEsZWYhpJpAIZlxmOTaCgbnjbFm6HBfXXQ74VWLvhK1vZfzUVf50i1IldXYYUj6qPsAqgmm7vXY375Ajwm8l4Q/s1600/Triggers.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9MfkVZrJiLEa6dEbCOJ0qOztNn8tNI-35gKyUfDowQNshaqO3NsBkvrEsZWYhpJpAIZlxmOTaCgbnjbFm6HBfXXQ74VWLvhK1vZfzUVf50i1IldXYYUj6qPsAqgmm7vXY375Ajwm8l4Q/s640/Triggers.jpg&quot; width=&quot;292&quot; /&gt;&lt;/a&gt;&lt;/div&gt;        &lt;/div&gt;         &lt;br&gt;  &amp;nbsp; &lt;br&gt;      &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;                   &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Arduino IDE and Library Downloads &lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      You will need an Arduino IDE to upload code to the Arduino and the Seeeduino Cloud.&lt;br&gt;        Here is the link to the Arduino IDE:  &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE - download location&lt;/a&gt;    &lt;/P&gt;      &lt;P&gt;      The Cayenne service requires that you download and install the Cayenne Library into your Arduino IDE.&lt;br&gt;        You can get the Cayenne Library from here:  &lt;a href=&quot;http://www.cayenne-mydevices.com/docs/#using-cayenne-library&quot;&gt;Cayenne Library File - Download&lt;/a&gt;&lt;br&gt;    &lt;/P&gt;    &lt;/div&gt;         &lt;br&gt;  &amp;nbsp; &lt;br&gt;        &lt;div style=&quot;text-align: justify;&quot;&gt;     &lt;P&gt;      &lt;h4&gt;Cayenne Connectivity Setup&lt;/h4&gt;    &lt;/P&gt;           &lt;P&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;The Seeeduino Cloud&lt;/span&gt;&lt;/b&gt; needs to be prepared for use with Cayenne. &lt;br&gt;       Normal operating/setup instructions can be found here: &lt;a href=&quot;http://wiki.seeedstudio.com/wiki/Seeeduino_Cloud&quot;&gt;Seeeduino Cloud WIKI page&lt;/a&gt;&lt;br&gt;       &amp;nbsp; &lt;br&gt;         Once you have successfully connected Seeeduino Cloud to your WIFI network, you can add it to the Cayenne Dashboard by making the following selections from within the Cayenne Web application:&lt;br&gt;       &lt;ol&gt;            &lt;li&gt;Add New&lt;/li&gt;          &lt;li&gt;Device/Widget&lt;/li&gt;          &lt;li&gt;Microcontrollers&lt;/li&gt;          &lt;li&gt;Arduino&lt;/li&gt;            &lt;li&gt;Ensure Seeeduino Cloud is connected to WIFI network - the select the NEXT button&lt;/li&gt;            &lt;li&gt;Select - Arduino Yun: Built-in Ethernet - ticked&lt;/li&gt;          &lt;li&gt;Providing you have already installed the Cayenne library as described above - you should be able to copy and paste the code to the Arduino IDE and upload                to the Seeeduino Cloud.&lt;/li&gt;          &lt;li&gt;If successful, you should see the Arduino Yun board appear within the Cayenne Dashboard. If not, then seek help within the &lt;a href=&quot;http://community.mydevices.com/c/arduino-beta&quot;&gt;Cayenne forum.&lt;/a&gt;       &lt;/ol&gt;    &lt;/P&gt;     &lt;P&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgpKR8bIVQUmUfMFNWGj9abuyiNfyxMhgo3-Dk9m4J9njf5bRfsaispxyG4bxS3IFrMWf4dGLMtXl0iQ7u9yJtaNgqONuPWHc9j8T-LHdqbTjMjXl8n0cYxZ4lfTWydzIeWZLYiylkxCA/s1600/Slide39.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgpKR8bIVQUmUfMFNWGj9abuyiNfyxMhgo3-Dk9m4J9njf5bRfsaispxyG4bxS3IFrMWf4dGLMtXl0iQ7u9yJtaNgqONuPWHc9j8T-LHdqbTjMjXl8n0cYxZ4lfTWydzIeWZLYiylkxCA/s320/Slide39.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;     &lt;/P&gt;               &lt;br&gt;  &amp;nbsp; &lt;br&gt;           &lt;P&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;The Arduino UNO with WIZNET 5100 - Ethernet Shield&lt;/span&gt;&lt;/b&gt;&lt;br&gt; also needs to be prepared with Cayenne&lt;br&gt;          &lt;ol&gt;            &lt;li&gt;Add New&lt;/li&gt;          &lt;li&gt;Device/Widget&lt;/li&gt;          &lt;li&gt;Microcontrollers&lt;/li&gt;          &lt;li&gt;Arduino&lt;/li&gt;            &lt;li&gt;Ensure Arduino is powered, and Ethernet shield is connected to your internet router via an Ethernet cable &lt;/li&gt;            &lt;li&gt;Select - Arduino Uno: Ethernet Shield W5100 - ticked&lt;/li&gt;          &lt;li&gt;Copy and paste the code to the Arduino IDE and upload to the Arduino UNO.&lt;/li&gt;          &lt;li&gt;If successful, you should see the Arduino Uno board appear within the Cayenne Dashboard. If not, then seek help within the &lt;a href=&quot;http://community.mydevices.com/c/arduino-beta&quot;&gt;Cayenne forum.&lt;/a&gt;       &lt;/ol&gt;                         &lt;br&gt;  &amp;nbsp; &lt;br&gt;              &lt;P&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGD4M02d3Anc7kMTbRQcSB0SpcqTZL7-v-lHpjDs-ahdvqEL3A4c-ycghYhcnY0fJr6jFY_JKNgjMwcmJfzsC0Sr5OhUI3BKBvx37qos4hkq6DjbYHIeDtF-ErMxQ7XVQTAWmiAGWCSQU/s1600/Slide37.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGD4M02d3Anc7kMTbRQcSB0SpcqTZL7-v-lHpjDs-ahdvqEL3A4c-ycghYhcnY0fJr6jFY_JKNgjMwcmJfzsC0Sr5OhUI3BKBvx37qos4hkq6DjbYHIeDtF-ErMxQ7XVQTAWmiAGWCSQU/s320/Slide37.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;       &lt;/P&gt;                       &lt;br&gt;  &amp;nbsp; &lt;br&gt;                 If you have the Ethernet shield with the WIZNET 5200 chip, then you may need to download a specific &lt;a href=&quot;https://github.com/Seeed-Studio/Ethernet_Shield_W5200&quot;&gt;Ethernet library&lt;/a&gt; in addition to the Cayenne library.        &lt;br&gt;       &amp;nbsp;&lt;br&gt;       Just follow the instructions within the Automatically generated sketch provided - when you select your specific Arduino/Ethernet/WIFI shield combination.        If you need further instructions on connecting your device to Cayenne - then please visit the &lt;a href=&quot;http://www.cayenne-mydevices.com/docs/#introduction&quot;&gt;myDevices website for the online documentation&lt;/a&gt;.     &lt;/P&gt;             &lt;br&gt;  &amp;nbsp; &lt;br&gt;           &lt;P&gt;           &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge4445-Xg_ctaMhYB7m326jv_nDVjYQ5votX9WqbrxbCDUQxFK4mYf8NOcgN-3qtfe7ebAHTAyDrNZRl-A-BcAGDlLc1PZ0LjWBHNG6pG_96AYeMM7LTFJneRcnVBt8fuYlOz4JkHVLVs/s1600/Slide38.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge4445-Xg_ctaMhYB7m326jv_nDVjYQ5votX9WqbrxbCDUQxFK4mYf8NOcgN-3qtfe7ebAHTAyDrNZRl-A-BcAGDlLc1PZ0LjWBHNG6pG_96AYeMM7LTFJneRcnVBt8fuYlOz4JkHVLVs/s640/Slide38.PNG&quot; width=&quot;320&quot; height=&quot;240&quot; /&gt;&lt;/a&gt;&lt;/div&gt;       &lt;/P&gt;             &lt;/P&gt;         &lt;/div&gt;             &lt;br&gt;  &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;     &lt;div id=&quot;Arduino Code&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE (1)&lt;/h4&gt; &lt;br&gt;      &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Code for Arduino UNO with Ethernet Shield:&lt;/span&gt;&lt;/h3&gt;        The following code will need to be uploaded to the Arduino UNO:     &lt;/P&gt;    &lt;P&gt;      &lt;script src=&quot;https://gist.github.com/ArduinoBasics/22da154ba7928711c47e210774589e67.js&quot;&gt;&lt;/script&gt;    &lt;/P&gt;  &lt;/div&gt;         &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;          &lt;div id=&quot;Arduino Code2&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE (2)&lt;/h4&gt; &lt;br&gt;      &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Code for Seeeduino Cloud:&lt;/span&gt;&lt;/h3&gt;         The following code will need to be uploaded to the Seeeduino Cloud:     &lt;/P&gt;    &lt;P&gt;       &lt;script src=&quot;https://gist.github.com/ArduinoBasics/791b6593e5969a800d35bfaf9311cfb5.js&quot;&gt;&lt;/script&gt;     &lt;/P&gt;  &lt;/div&gt;           &lt;br&gt;  &amp;nbsp; &lt;br&gt;     &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;     &lt;div id=&quot;Hooking it up&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Fritzing diagram (1)&lt;/h4&gt;&lt;br&gt;      &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Fritzing diagram for Arduino UNO with Ethernet&lt;/span&gt;&lt;/h3&gt;      &lt;/P&gt;    &lt;P&gt;      Please click on the picture below for an enlarged version of this fritzing diagram &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOBwCkr-RJAmuFz7_eKOF9rt5I0ZV1nL4iMqXb7Po2au-EFkDdHBRfYhl7MWNBI7KOjNaB6zn8DMlT-Ed3Xlmfp9iuIOQBx5kVHe56E203hHqL6rzA-mWmW6SqTe6GGJPfNYtSSWNMT70/s1600/Ethernet_PIR_PhotoR.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOBwCkr-RJAmuFz7_eKOF9rt5I0ZV1nL4iMqXb7Po2au-EFkDdHBRfYhl7MWNBI7KOjNaB6zn8DMlT-Ed3Xlmfp9iuIOQBx5kVHe56E203hHqL6rzA-mWmW6SqTe6GGJPfNYtSSWNMT70/s640/Ethernet_PIR_PhotoR.png&quot; width=&quot;325&quot; /&gt;&lt;/a&gt;&lt;/div&gt;    &lt;/P&gt; &lt;/div&gt;           &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;            &lt;div id=&quot;Hooking it up2&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Fritzing diagram (2)&lt;/h4&gt;&lt;br&gt;      &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Fritzing diagram for Seeeduino Cloud&lt;/span&gt;&lt;/h3&gt;      &lt;/P&gt;    &lt;P&gt;      Please click on the picture below for an enlarged version of this fritzing diagram&lt;br&gt;                 &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9Pcx2plrmFNOXdUjjFBvmxYbYhWEUMhGDbbFVMfJbxTy8N51-D43mhfhcNRlVjJdoLtlJc1778JY-8ycAV00a9Q-xUdUA4Ke3az_bYb2EGxHQVkGdcC-ZflatjwE91KKOMshRIZ9oj7s/s1600/Yun_MP3_RFID_Laser_with+parts7.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;241&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9Pcx2plrmFNOXdUjjFBvmxYbYhWEUMhGDbbFVMfJbxTy8N51-D43mhfhcNRlVjJdoLtlJc1778JY-8ycAV00a9Q-xUdUA4Ke3az_bYb2EGxHQVkGdcC-ZflatjwE91KKOMshRIZ9oj7s/s640/Yun_MP3_RFID_Laser_with+parts7.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;    &lt;/P&gt;    &lt;/div&gt;        &lt;br&gt;  &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;   &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;     &amp;nbsp; &lt;br&gt;     &lt;div id=&quot;Setting up the Dashboard&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Cayenne Dashboard Setup - GUI&lt;/h4&gt; &lt;br&gt;              The Arduino code only provides half of the functionality of this project. The Cayenne Dashboard needs to be setup to       provide the rest of the functionality.  The following instructions will show you how to add each of the widgets required for this Home Security project.     &lt;/P&gt; &lt;BR&gt;         &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Arduino Ethernet - Master Switch&lt;/span&gt;&lt;/h3&gt;          &lt;P&gt;       The master switch allows me to turn the security system on and off. When I turn the MASTER SWITCH ON, the laser beam will turn on, and the sensors will start monitoring the area for intruders.      This widget is NOT associated with a physical switch/sensor on the Arduino  - it uses virtual channel 0.      We need to add the Master switch to the dashboard: &lt;br&gt;             &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhobhtYPeONkYKA9fAd8Pg7w2iMECDs94QyUA6TOXbCbGL2661DbYXRLKjRIn7ij8H9XSIxKMeXnSUSC1bY-9tVEkRqnsA50_1h6z0SQvrUXmYDy-qEpg0Xvgy0CSlMNnnj4p2qqwpud6Q/s1600/Slide55.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhobhtYPeONkYKA9fAd8Pg7w2iMECDs94QyUA6TOXbCbGL2661DbYXRLKjRIn7ij8H9XSIxKMeXnSUSC1bY-9tVEkRqnsA50_1h6z0SQvrUXmYDy-qEpg0Xvgy0CSlMNnnj4p2qqwpud6Q/s320/Slide55.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;     &lt;br&gt;              &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Actuators&lt;/li&gt;        &lt;li&gt;Generic&lt;/li&gt;        &lt;li&gt;Digital Output - Control a Digital Output&lt;/li&gt;        &lt;li&gt;Widget Name: Master On Off Switch&lt;/li&gt;        &lt;li&gt;Select Device: Arduino Ethernet&lt;/li&gt;        &lt;li&gt;Connectivity: Virtual&lt;/li&gt;        &lt;li&gt;Pin: V0&lt;/li&gt;        &lt;li&gt;Choose Widget: Button&lt;/li&gt;        &lt;li&gt;Choose Icon: Valve&lt;/li&gt;           &lt;li&gt;Step2: Add Actuator&lt;/li&gt;     &lt;/ol&gt;           We will add a trigger later to get this button to automatically turn the Laser beam on.     &lt;/P&gt;           &lt;br&gt;  &amp;nbsp; &lt;br&gt;      &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;            &lt;/P&gt;    &lt;P&gt;      &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Arduino Ethernet - PIR Sensor&lt;/span&gt;&lt;/h3&gt;      &lt;/P&gt;     &lt;P&gt;       This sensor will be used to detect movement in the room. If a person walks into the room, this sensor will detect movement, and will trigger a message to be played on the      Grove Serial MP3 player. The message will aim to get the person to identify themselves. They identify themselves by placing their RFID tag in close proximity to the Grove RFID reader.      If the tag is valid, a &quot;Welcome home&quot; message is played on the Grove MP3 player. If a valid tag is not presented to the reader within 10 seconds, an Alarm will go off (&quot;Alarm sound&quot; played on Grove MP3 player.)                &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbp-_dBWli6MftAk4F6kzWvTg7hL2IvRTtsJUWLGGq30dNU7eL83L5iX5baFb5Ulbr3SIlK_fUYl2qRyPosQp0swqCYraRQ9UA1PWzVLfUI4JUpZBGG7D3augPafuGLJN_BejbB53cWmQ/s1600/Slide20.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot;  height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbp-_dBWli6MftAk4F6kzWvTg7hL2IvRTtsJUWLGGq30dNU7eL83L5iX5baFb5Ulbr3SIlK_fUYl2qRyPosQp0swqCYraRQ9UA1PWzVLfUI4JUpZBGG7D3augPafuGLJN_BejbB53cWmQ/s320/Slide20.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;    &lt;/P&gt;               The PIR sensor is connected to digital Pin 6 of the Arduino, however, it is mapped to virtual pin 1 for better synchronisation with the Cayenne dashboard. This was done to      capture ALL detections - as the PIR sensor could change from a LOW to HIGH and back to LOW state in between a Cayenne state check - and therefore, Cayenne could miss this motion detection..        Therefore we need to assign the PIR sensor to a virtual channel in the following way: &lt;br&gt;     &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Sensors&lt;/li&gt;        &lt;li&gt;Motion&lt;/li&gt;        &lt;li&gt;Digital Motion Sensor - Motion Detector&lt;/li&gt;        &lt;li&gt;Widget Name: PIR sensor&lt;/li&gt;        &lt;li&gt;Select Device: Arduino Ethernet&lt;/li&gt;        &lt;li&gt;Connectivity: Virtual&lt;/li&gt;        &lt;li&gt;Pin: V1&lt;/li&gt;        &lt;li&gt;Choose Widget: 2-State Display&lt;/li&gt;        &lt;li&gt;Choose Icon: Light&lt;/li&gt;           &lt;li&gt;Step2: Add Sensor&lt;/li&gt;          &lt;li&gt;Select Settings from the &lt;b&gt;PhotoResistor&lt;/b&gt;&lt;/li&gt;        &lt;li&gt;Choose Display: Value&lt;/li&gt;          &lt;li&gt;Save&lt;/li&gt;     &lt;/ol&gt;    &lt;/P&gt;           &lt;br&gt;  &amp;nbsp; &lt;br&gt;       &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;             &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Arduino Ethernet - Photoresistor&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;       This sensor will be used with the laser beam to create a laser tripwire. If the sensor detects a change in light levels (drops below the threshold), it will activate the       laser trigger button on the dashboard. The person will then be required to identify themselves etc etc (similar to the motion detection by the PIR sensor).      The photoresistor widget will display the raw analog reading from the sensor (connected to A2), but is associated with virtual channel 2. I used a virtual channel for more control over this sensor.       To add the Photoresistor to the dashboard:&lt;br&gt;     &lt;/P&gt;     &lt;P&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdQScmbIs-ViZ322DtyDe73Qps0s0crcaiibmP2XBpzwS48GTjMEgQSclBKWddPt2lZWaaVw263BJunOdEUBcDVXKFnW3uej6UsbPUGDJ-ODqhDsU4GmTes4jDn9Vd2axpE16PRcOoqKU/s1600/Slide57.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdQScmbIs-ViZ322DtyDe73Qps0s0crcaiibmP2XBpzwS48GTjMEgQSclBKWddPt2lZWaaVw263BJunOdEUBcDVXKFnW3uej6UsbPUGDJ-ODqhDsU4GmTes4jDn9Vd2axpE16PRcOoqKU/s320/Slide57.PNG&quot; width=&quot;320&quot; height=&quot;240&quot; /&gt;&lt;/a&gt;&lt;/div&gt;          &lt;/P&gt;     &lt;P&gt;     &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Sensors&lt;/li&gt;        &lt;li&gt;Luminosity&lt;/li&gt;        &lt;li&gt;Photoresistor - Luminosity sensor&lt;/li&gt;        &lt;li&gt;Widget Name: PhotoResistor&lt;/li&gt;        &lt;li&gt;Select Device: Arduino Ethernet&lt;/li&gt;        &lt;li&gt;Connectivity: Virtual&lt;/li&gt;        &lt;li&gt;Pin: V2&lt;/li&gt;        &lt;li&gt;Choose Widget: Value&lt;/li&gt;        &lt;li&gt;Choose Icon: Light&lt;/li&gt;           &lt;li&gt;Step2: Add Sensor&lt;/li&gt;       &lt;/ol&gt;    &lt;/P&gt;           &lt;br&gt;  &amp;nbsp; &lt;br&gt;      &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;                 &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Arduino Ethernet - Laser Trigger&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;       The laser trigger is just an indicator that someone tripped the laser beam. The state of this widget is used to notify the Seeeduino that a presence has been detected.      This widget is associated with virtual pin 4 on the Arduino UNO with Ethernet.      &lt;/P&gt;         &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcnm_lYO7Ob5F4FT2k7ywVJda08jstRD3FTnaEfzSjhJtKlg-K-dm4x7M5lgDpv4QQKNgc8fy_Oqk-BixdJ5CHHITdT8CwDuN8E6r7UJrNU_UzaODBAJFifCLTcTNDeCxeehJ1x94f3UU/s1600/Slide46.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcnm_lYO7Ob5F4FT2k7ywVJda08jstRD3FTnaEfzSjhJtKlg-K-dm4x7M5lgDpv4QQKNgc8fy_Oqk-BixdJ5CHHITdT8CwDuN8E6r7UJrNU_UzaODBAJFifCLTcTNDeCxeehJ1x94f3UU/s320/Slide46.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;       &lt;/P&gt;    &lt;P&gt;           &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Actuators&lt;/li&gt;        &lt;li&gt;Generic&lt;/li&gt;        &lt;li&gt;Digital Output - Control a Digital Output&lt;/li&gt;        &lt;li&gt;Widget Name: Laser Trigger&lt;/li&gt;        &lt;li&gt;Select Device: Arduino Ethernet&lt;/li&gt;        &lt;li&gt;Connectivity: Virtual&lt;/li&gt;        &lt;li&gt;Pin: V4&lt;/li&gt;        &lt;li&gt;Choose Widget: Button&lt;/li&gt;        &lt;li&gt;Choose Icon: Lock&lt;/li&gt;           &lt;li&gt;Step2: Add Actuator&lt;/li&gt;     &lt;/ol&gt;    &lt;/P&gt;                 &lt;br&gt;  &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;                 &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Arduino Ethernet - Laser Threshold&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;       The laser threshold is used to manually configure the light level at which the laser trigger will trip. When the photoresistor value drops below the threshold value,      the laser trigger icon will activate. This allows the threshold value to be updated from the Cayenne dashboard, rather than having to manually adjust the value in the Arduino code.      Also, this threshold can be set remotely, in that you don&#39;t have to be near the Arduino to change this value. A very useful feature of this Security system.      This widget is associated with virtual pin 5 on the Arduino UNO with Ethernet.      &lt;/P&gt;         &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi03C7jqOHqJPTH0XwAfDYKfRjOWBImZhhGZ8sT0hWvdLIIc-xjwXvQpP0s4qnXvuE4rwYDF-1gIn2ohXreKRqGoQcP2BaUzaX6R8TebTSrnfapcuU9ScwcycglFoLgaGu2Ue5LyoNByKs/s1600/Slide59.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi03C7jqOHqJPTH0XwAfDYKfRjOWBImZhhGZ8sT0hWvdLIIc-xjwXvQpP0s4qnXvuE4rwYDF-1gIn2ohXreKRqGoQcP2BaUzaX6R8TebTSrnfapcuU9ScwcycglFoLgaGu2Ue5LyoNByKs/s320/Slide59.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;      &lt;/P&gt;    &lt;P&gt;           &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Actuators&lt;/li&gt;        &lt;li&gt;Generic&lt;/li&gt;        &lt;li&gt;PWM Output - Control a PWM Output&lt;/li&gt;        &lt;li&gt;Widget Name: Laser Threshold&lt;/li&gt;        &lt;li&gt;Select Device: Arduino Ethernet&lt;/li&gt;        &lt;li&gt;Connectivity: Virtual&lt;/li&gt;        &lt;li&gt;Pin: V5&lt;/li&gt;        &lt;li&gt;Choose Widget: Slider&lt;/li&gt;        &lt;li&gt;Slider Min Value: 0&lt;/li&gt;        &lt;li&gt;Slider Max Value: 10&lt;/li&gt;           &lt;li&gt;Step2: Add Actuator&lt;/li&gt;     &lt;/ol&gt;           The max value of the slider is 10 - due to a current bug in the Cayenne software. Once resolved, this value (as well as the relevant Arduino code) will need to be updated.           &lt;/P&gt;           &lt;br&gt;  &amp;nbsp; &lt;br&gt;      &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;            &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Seeeduino Cloud - Presence Detected&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;       The presence detected widget is there to notify the Seeeduino Cloud that a presence has been detected on the Arduino Uno with Ethernet shield. When the PIR sensor detects movement       or if the laser tripwire is tripped, Cayenne will change the state of the Presence Detected widget from LOW to HIGH. This is used within the Seeeduino Cloud to trigger the      message &quot;Place your keys on the Mat&quot;&lt;br&gt;. If a valid RFID tag is read by the Grove RFID reader, then this widget&#39;s state will change back from HIGH to LOW, and the MasterSwitch will       be deactivated - turning the Security system off.      This widget is associated with Virtual pin 6 on the Seeeduino Cloud.      &lt;/P&gt;     &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLdJDFEHpXcY6oZKFEsnKvIvO5yWo44eBIVyrXAmy-LVjqufBtQ-VpNCfMDtUpFFREurXV1T6IICEkdruDVOEFfbVu7nJ8VZioDTSCkn0rTOXbl16BXDDFzJHJznB5zhF4W5oZriWL_kI/s1600/Slide22.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLdJDFEHpXcY6oZKFEsnKvIvO5yWo44eBIVyrXAmy-LVjqufBtQ-VpNCfMDtUpFFREurXV1T6IICEkdruDVOEFfbVu7nJ8VZioDTSCkn0rTOXbl16BXDDFzJHJznB5zhF4W5oZriWL_kI/s320/Slide22.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;      &lt;/P&gt;    &lt;P&gt;           &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Actuators&lt;/li&gt;        &lt;li&gt;Generic&lt;/li&gt;        &lt;li&gt;Digital Output - Control a Digital Output&lt;/li&gt;        &lt;li&gt;Widget Name: Presence Detected&lt;/li&gt;        &lt;li&gt;Select Device: Seeeduino Cloud&lt;/li&gt;        &lt;li&gt;Connectivity: Virtual&lt;/li&gt;        &lt;li&gt;Pin: V6&lt;/li&gt;        &lt;li&gt;Choose Widget: Button&lt;/li&gt;        &lt;li&gt;Choose Icon: Lock&lt;/li&gt;           &lt;li&gt;Step2: Add Actuator&lt;/li&gt;     &lt;/ol&gt;    &lt;/P&gt;            &lt;br&gt;  &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;                  &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Seeeduino Cloud - Intruder Alert&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;       If a valid RFID tag is not read by the Grove RFID reader within 10 seconds of a presence detection event, an alarm will sound, and this widget will be activated.      This will trigger a notification event - to notify me of the unauthorised intrusion - via SMS or email. I will also have a visual indicator on the Cayenne dashboard that an intrusion has taken place.      This widget is associated with Virtual pin 7 on the Seeeduino Cloud.      &lt;/P&gt;         &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMZRqvxaYZloWZ8W4lN7ttx8KijXVDvQzbfPBIma-HYDBHeQiTVTUUUn0fL1w5TiM9Mgfheyy0HKDSQNXayist4YxY0xnry7Ra24TqxeuO04gkf7HSGinLw_0ip4VVsdPVFnvTaXWsjh0/s1600/Slide32.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMZRqvxaYZloWZ8W4lN7ttx8KijXVDvQzbfPBIma-HYDBHeQiTVTUUUn0fL1w5TiM9Mgfheyy0HKDSQNXayist4YxY0xnry7Ra24TqxeuO04gkf7HSGinLw_0ip4VVsdPVFnvTaXWsjh0/s320/Slide32.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;      &lt;/P&gt;    &lt;P&gt;           &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Actuators&lt;/li&gt;        &lt;li&gt;Generic&lt;/li&gt;        &lt;li&gt;Digital Output - Control a Digital Output&lt;/li&gt;        &lt;li&gt;Widget Name: Laser Trigger&lt;/li&gt;        &lt;li&gt;Select Device: Seeeduino Cloud&lt;/li&gt;        &lt;li&gt;Connectivity: Virtual&lt;/li&gt;        &lt;li&gt;Pin: V7&lt;/li&gt;        &lt;li&gt;Choose Widget: Button&lt;/li&gt;        &lt;li&gt;Choose Icon: Thermometer&lt;/li&gt;           &lt;li&gt;Step2: Add Actuator&lt;/li&gt;     &lt;/ol&gt;    &lt;/P&gt;            &lt;br&gt;  &amp;nbsp; &lt;br&gt;        &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;            &lt;P&gt;       &lt;h3&gt;&lt;span style=&quot;color:#6BABAB&quot;&gt;Seeeduino Cloud - Laser Beam&lt;/span&gt;&lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;       The laser beam widget was created to allow for full control over the laser beam.      The laser beam can be turned on or off from the Cayenne dashboard, and a connected to digital pin 7 on the Seeeduino Cloud.       &lt;/P&gt;     &lt;P&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc8UGlqKNDPgvIzev7YeUsovuHorwfN4GwsYT7n7NhsCg_R0iAX0w0Ju8gD4mTnkoI5UQ9iRJZYwmAXagEH_zaz7r54Scm5pwvTQ1Gm8G9-nULIoQGHUPGVnm02iMClJBnCtOSoUGJRcE/s1600/Slide21.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc8UGlqKNDPgvIzev7YeUsovuHorwfN4GwsYT7n7NhsCg_R0iAX0w0Ju8gD4mTnkoI5UQ9iRJZYwmAXagEH_zaz7r54Scm5pwvTQ1Gm8G9-nULIoQGHUPGVnm02iMClJBnCtOSoUGJRcE/s320/Slide21.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;    &lt;/P&gt;     &lt;P&gt;     &lt;ol&gt;        &lt;li&gt;Add New&lt;/li&gt;        &lt;li&gt;Device/Widget&lt;/li&gt;        &lt;li&gt;Actuators&lt;/li&gt;        &lt;li&gt;Light&lt;/li&gt;        &lt;li&gt;Light Switch - Turn On/Off a Light&lt;/li&gt;        &lt;li&gt;Widget Name: xLaser Beam&lt;/li&gt;        &lt;li&gt;Select Device: Seeeduino Cloud&lt;/li&gt;        &lt;li&gt;Connectivity: Digital&lt;/li&gt;        &lt;li&gt;Pin: D7&lt;/li&gt;        &lt;li&gt;Choose Widget: Button&lt;/li&gt;        &lt;li&gt;Choose Icon: Light&lt;/li&gt;           &lt;li&gt;Step2: Add Actuator&lt;/li&gt;     &lt;/ol&gt;    &lt;/P&gt;         &lt;/div&gt;       &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;     &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;     &lt;P&gt;       &lt;h4&gt;Cayenne Triggers&lt;/h4&gt;         Now that all of the widgets have been added to the Dashboard, there is just one more step to complete the Security System.      We need to setup the triggers. These triggers provide a level of automation that is easy to create within Cayenne, but would be very complicated otherwise.      I set my triggers up as per the table below. Each row represents one of the triggers within my Cayenne dashboard.      If you would like to see an example of how to add a trigger - please have a look at the video at the top of this tutorial.       &amp;nbsp; &lt;br&gt;    &lt;/P&gt;          &lt;/div&gt;     &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhe_4BjDPR9h8EKel8IMcuAT-HF4TJz8SxMUKsZPE4pRMQSg0x5En8KHOiGZihLs0oDlSya_nQq0xtriDUaie5_yIAuFpM8LtBw2bKgWPE7_Axebrq7rgONoIMTIopWygNBXpppicUwmE/s1600/Cayenne+Triggers.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhe_4BjDPR9h8EKel8IMcuAT-HF4TJz8SxMUKsZPE4pRMQSg0x5En8KHOiGZihLs0oDlSya_nQq0xtriDUaie5_yIAuFpM8LtBw2bKgWPE7_Axebrq7rgONoIMTIopWygNBXpppicUwmE/s640/Cayenne+Triggers.jpg&quot; width=&quot;640&quot; height=&quot;264&quot; /&gt;&lt;/a&gt;&lt;/div&gt;                    &lt;br&gt;  &amp;nbsp; &lt;br&gt;     &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;   &amp;nbsp; &lt;br&gt;    &amp;nbsp; &lt;br&gt;          &lt;div id=&quot;Concluding comments&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;h4&gt;Concluding comments&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      I used many different elements to put this home/office security project together - Multiple Arduinos were connected to the internet, both controlled by a web/smart phone app, cross-communication/synchronisation between the Arduinos,       and the use of multiple sensors and modules including a laser beam ! &lt;br&gt;      &amp;nbsp;&lt;br&gt;      This was way more than just a simple PIR sense and alarm project. I now have a personalised greeting and reminder system when I walk in the door. Everyone else has their own personalised greeting.        I can enable my Security System remotely, from two blocks away, and if I wanted to - I could enable it from the other side of the world.         I know instantly when someone has entered my house/office.... with an SMS alert straight to my phone.       &lt;br&gt;      &amp;nbsp; &lt;br&gt;                 This project could easily be extended: &lt;br&gt;      &lt;ol&gt;        &lt;li&gt;Press a button on my phone to manually trigger/play a specific message/sound/song&lt;/li&gt;          &lt;li&gt;Take a picture of the intruder&lt;/li&gt;        &lt;li&gt;Introduce fire or leak detection aswell&lt;/li&gt;        &lt;li&gt;Add other environmental sensors - Temperature / Humidity&lt;/li&gt;        &lt;li&gt;Connect it to lamp/light - creating a security light&lt;/li&gt;      &lt;/ol&gt;               I am sure you can think of more things I could do with this system. In fact, why don&#39;t you mention your ideas in the comments below.&lt;br&gt;      &amp;nbsp;&lt;br&gt;      Cayenne was instrumental in getting this project to work. I don&#39;t think I would know where to start if I had to do this project without this cool IoT platform.       I think I will definitely be trying out a few more projects using Cayenne, and should you want to do the same, then please make sure to join Cayenne Beta:&lt;br&gt;      &amp;nbsp;&lt;br&gt;      Here is the link you need to get to the right place: &lt;a href=&quot;http://goo.gl/0lLUR7&quot;&gt;Cayenne Beta Link&lt;/a&gt;&lt;br&gt;        &lt;br&gt;  &amp;nbsp; &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijXNqv886x_sCTJiyY3Ib4jl1hWpzFPY8yBIYZ40tDl64wsDxuLvKfOZNL77_bvg8FDY6hT8GUYEJaYiUz6_lxbKCqsL58eLyWDmmwnqZsxLQfouVtzFbkKNhSvrt0lLbHPkRfsy1eZh0/s1600/Slide19.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijXNqv886x_sCTJiyY3Ib4jl1hWpzFPY8yBIYZ40tDl64wsDxuLvKfOZNL77_bvg8FDY6hT8GUYEJaYiUz6_lxbKCqsL58eLyWDmmwnqZsxLQfouVtzFbkKNhSvrt0lLbHPkRfsy1eZh0/s640/Slide19.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;     &lt;/P&gt;  &lt;/div&gt;      &lt;div align=&quot;center&quot;&gt;    If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;    &lt;br /&gt;    &amp;nbsp;     &lt;br /&gt;    Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br /&gt;    Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br /&gt;    I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br /&gt;    Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;. &lt;/div&gt;    &lt;br /&gt;  &lt;div id=&quot;ArduinoBasics Project Page Link&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;P&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;    &lt;/P&gt;&lt;/div&gt;                             </content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/5216646627805152630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2016/09/arduino-based-security-project-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/5216646627805152630'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/5216646627805152630'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2016/09/arduino-based-security-project-using.html' title='Arduino based Security Project Using Cayenne'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijXNqv886x_sCTJiyY3Ib4jl1hWpzFPY8yBIYZ40tDl64wsDxuLvKfOZNL77_bvg8FDY6hT8GUYEJaYiUz6_lxbKCqsL58eLyWDmmwnqZsxLQfouVtzFbkKNhSvrt0lLbHPkRfsy1eZh0/s72-c/Slide19.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-7394212545484989680</id><published>2016-06-04T13:38:00.000+07:00</published><updated>2018-03-28T22:35:14.054+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino UNO"/><category scheme="http://www.blogger.com/atom/ns#" term="Cake"/><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="Disco"/><category scheme="http://www.blogger.com/atom/ns#" term="DiscoBall"/><category scheme="http://www.blogger.com/atom/ns#" term="Example"/><category scheme="http://www.blogger.com/atom/ns#" term="FastLED"/><category scheme="http://www.blogger.com/atom/ns#" term="Fritzing"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Light"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="RGB"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="WS2812-B"/><title type='text'>Arduino Disco Ball Cake</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/xObHSWpaT-k?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;      &lt;/div&gt;    &lt;/P&gt;  &lt;/div&gt;    &lt;div&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt;    &lt;P&gt;      &lt;H4&gt;Description&lt;/H4&gt;    &lt;/P&gt;    &lt;P&gt;      This is a fun project that will surely impress anyone you make this for. If you are having a &quot;Disco&quot; themed party, you cannot have a boring old cake.        Let me tell you, this is probably the only Arduino project that my wife has ever been willing to be a part of. She did the hard work of putting the cake together, and I, well.... I was in charge of lighting.       My biggest fear was that one of the wires would come loose and ruin the event at the most critical moment... While a wire did come loose, I managed to fix it in time before the guests arrived.       Ok enough of my monologue, let me show you how to make one of these things.      &lt;/P&gt;    &lt;P&gt;       &amp;nbsp; &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJnx0DHVEhPnLdT_Z_d0qz4QetH1modr6apMLyUzSSjoEhQFWCfDJGaODu1Iuy8Pyr3s29TBbIfUtrEhOeVrBpRKekERZCY_KhuoHBw_wFgZDqHuwialQjK_QBQ4RQTeQEKVZRWcUcU84/s1600/Slide2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJnx0DHVEhPnLdT_Z_d0qz4QetH1modr6apMLyUzSSjoEhQFWCfDJGaODu1Iuy8Pyr3s29TBbIfUtrEhOeVrBpRKekERZCY_KhuoHBw_wFgZDqHuwialQjK_QBQ4RQTeQEKVZRWcUcU84/s640/Slide2.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;      &lt;/P&gt;  &lt;/div&gt;         &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;Parts Required:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;ul&gt;        &lt;li&gt;&lt;a href=&quot;http://goo.gl/a1Xlm9&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://goo.gl/OCC0Pg&quot;&gt; 4 x  WS2812-B Programmable Colorful LED Board&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Passive-Components/Resistors/Carbon-Film/330ohm-1-Watt-5%25-Carbon-Film-Resistor---Pk-2/p/RR2762&quot;&gt;330 ohm resistor&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Passive-Components/Capacitors/Electrolytic/4700uF-16V-RB-Electrolytic-Capacitor---105oC/p/RE6243&quot;&gt;4700 uF 16V Electrolytic Capacitor&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Service-Aids/PCB-Accessories/Breadboards/Arduino-Compatible-Mini-Breadboard-with-170-Tie-Points-/p/PB8817&quot;&gt;Breadboard&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://goo.gl/mRok02&quot;&gt;Female to Male Jumper wires&lt;/a&gt;&lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://goo.gl/8Nzwzr&quot;&gt;Breadboard Jumper wires&lt;/a&gt;&lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Interconnect/Plugs%2C-Sockets-%26-Adaptors/DC-Power/2-1mm-DC-Socket-with-Screw-Terminals/p/PA3713&quot;&gt;2.1mm DC Socket with Screw Terminals&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.altronics.com.au/p/m8911a-powertran-5v-dc-4a-fixed-2.1mm-tip-appliance-plugpack/&quot;&gt;5V 4A Plugpack power supply&lt;/a&gt;&lt;/li&gt;  &lt;br&gt;     &lt;/P&gt;     &lt;P&gt;Note: powering this project using batteries is possible, but not recommended, and done at your own risk. &lt;/P&gt;     &lt;P&gt;You will also need a Disco Ball Cake which you will have to make(or buy).My wife made this one. And as you will see shortly, the cake on the inside was Pink, because it was a strawberry cake.           &lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;  &lt;/div&gt;    &lt;br&gt;     &lt;div&gt;    &lt;P&gt;      &lt;h4&gt;Arduino Libraries and IDE&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;!--Write Arduino Library and IDE information below--&gt;      You can get the Arduino IDE from here: &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;https://www.arduino.cc/en/Main/Software&lt;/a&gt;&lt;br&gt;      I used version 1.6.4, which is probably way out of date... but works fine nonetheless.&lt;br&gt; &amp;nbsp;       &lt;br&gt;      You can get information about how to use the FastLED library here: &lt;a href=&quot;http://fastled.io/&quot;&gt;http://fastled.io/&lt;/a&gt;&lt;br&gt;      And you can download it from here: &lt;a href=&quot;https://github.com/FastLED/FastLED/releases&quot;&gt;FastLED Library &lt;/a&gt;&lt;br&gt;      I used version 3.0.3, which is also probably out of date.     &lt;/P&gt;  &lt;/div&gt;     &lt;div id=&quot;Arduino Code&quot;&gt;    &lt;P&gt;      &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;    &lt;/P&gt;    &lt;P&gt;      &lt;!--Paste CodeBender Embed code below--&gt;         &lt;script src=&quot;https://gist.github.com/ArduinoBasics/b2918835cef34ef3a918da7f3a260e0b.js&quot;&gt;&lt;/script&gt;    &lt;/P&gt;  &lt;/div&gt;    &lt;div id=&quot;Arduino Code Description&quot; style=&quot;text-align: justify;&quot;&gt;      &lt;h4&gt;ARDUINO CODE DESCRIPTION:&lt;/h4&gt;    &lt;P&gt;      &lt;!--Write your comments about the code below--&gt;      &lt;ul&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;FastLED Library:&lt;/font&gt;&lt;/b&gt; You need to make sure that you have downloaded and installed the FastLED library into your Arduino IDE. The library is included in this sketch otherwise the FastLED functions will not work.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;The &quot;NUM_LEDS&quot; variable:&lt;/font&gt;&lt;/b&gt; tells the Arduino how many LEDS are in use. In this case, we have 4 LED rings, with each LED ring containing 16 LEDs, and therefore a total of 64 LEDs.                    If you define a lower number, for example 16, then the sketch would only illuminate the LEDs on the first LED ring.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;The &quot;DATA_PIN&quot; variable:&lt;/font&gt;&lt;/b&gt; tells the Arduino which Digital Pin to use for data transmission to the LED ring. In this case, I am using Digital Pin 9.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Other variables:&lt;/font&gt;&lt;/b&gt; I have a couple of other variables which are used for LED randomisation and hue control.                  Hue is the colour of the LED. By incrementing the hue variable, you can get the LEDs to cycle in a rainbow-like pattern.                  The &quot;hue&quot; variable is a &quot;byte&quot;, which means that it will only go up to a maximum value of 255, before it jumps back down to zero.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Initialisation Code:&lt;/font&gt;&lt;/b&gt; If you have a &lt;a href=&quot;https://github.com/FastLED/FastLED/wiki/Overview#chipsets&quot;&gt;different LED ring&lt;/a&gt; to the one in this tutorial, you may have to modify the initialisation code.                   This LED ring has a WS2812-B chipset (according to the ICStation website), and so this line:&lt;br&gt;                     &amp;nbsp; &lt;br&gt;                    &lt;b&gt;FastLED.addLeds&lt;NEOPIXEL,DATA_PIN&gt;(leds, NUM_LEDS); &lt;/b&gt;                  Will tell the FastLED library which chipset is being used (NEOPIXEL), the pin used for data transmission (DATA_PIN), the LED array to be controlled (leds), and the number of LEDs to be controlled (NUM_LEDS).&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;In the &quot;loop()&quot;:&lt;/font&gt;&lt;/b&gt; section of the code: the &quot;hue&quot; variable is incremented to create a rainbow effect, and a random LED is selected using the FastLED&#39;s random8() function.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;The random8(x) function:&lt;/font&gt;&lt;/b&gt; will randomly choose a number from 0 to x.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;The randomSeed() function:&lt;/font&gt;&lt;/b&gt; is there to help &quot;truely randomise&quot; the number. This is helped by reading the randomness of a floating analogPin (A0).        It doesn&#39;t have to be analogPin 0, it can be any unused analog pin.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;leds[rnd].setHSV(hue,255,255):&lt;/font&gt;&lt;/b&gt;                This line sets the random LED to have a hue equal to the &quot;hue&quot; variable, saturation equal to 255, and brightness equal to 255. Saturation equal to zero will make the LED shine white. &lt;br&gt;                Brightness of zero essentially turns the LED OFF.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;FastLED.show(): &lt;/font&gt;&lt;/b&gt;                No physical changes will be made to the LED ring display until a message is sent from the Arduino to the Digital input pin of the LED ring.                 This message is transmitted when you call the FastLED.show(); function.                 This tells the LED rings to update their display with the information contained within the led array (leds).                  So if you set all LEDs to turn on, the board will not illuminate the LEDs until the FastLED.show(); function is called.                  This is important to know - especially when trying to design your own LED sequences.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;The delay(50) line:&lt;/font&gt;&lt;/b&gt; will set the amount of time between flashes to 50 milliseconds. You can change the delay to increase or decrease the number of flashes per second.&lt;/li&gt;        &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;The leds[i].fadeToBlackBy( 180 ) function:&lt;/font&gt;&lt;/b&gt; essentially fades the LEDS by 180 units. You can increase or decrease this number to achieve the desired fade speed.       Be warned however, that if you forget to call this function or if you fail to fade the LEDs sufficiently, then you may end up with ALL LEDs turning on, which could potentially        destroy your Arduino board - i.e. depending on the number of LED rings you have, and how you have chosen to power them.&lt;/li&gt;    &lt;/ul&gt;         &lt;br&gt;    &amp;nbsp; &lt;br&gt;       &lt;/div&gt;    &lt;div id=&quot;Putting it together&quot; style=&quot;text-align: justify;&quot;&gt;         &lt;P&gt;        &lt;h4&gt;The Cake&lt;/h4&gt; &lt;br&gt;        &lt;iframe src=&quot;https://docs.google.com/presentation/d/1V8BP3F96Ul5QhRv6ISZC8mmS0u4j_6rT-V4JTZFqpVs/embed?start=false&amp;loop=false&amp;delayms=3000&quot; frameborder=&quot;0&quot; width=&quot;640&quot; height=&quot;509&quot; allowfullscreen=&quot;true&quot; mozallowfullscreen=&quot;true&quot; webkitallowfullscreen=&quot;true&quot;&gt;&lt;/iframe&gt;      &lt;/P&gt;      &lt;P&gt;        &lt;ul&gt;             &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Slide 1 - Base Plate:&lt;/font&gt;&lt;/b&gt; It is important to create the base plate with all of the electronics fitted and in working order BEFORE                                                                        you put the Cake onto it. Trying to fit wires/cables LEDs and circuits under the base plate while there is                                                                        a Cake ontop is a recipe for disaster. So prepare the base plate first, and then move to the cake making part later.  &lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Slide 2 - Bake Cake:&lt;/font&gt;&lt;/b&gt; You will need a couple of hemisphere cake pans to make the two sides of the ball.                                                                          You have to make a relatively dense cake to withstand the overall weight of the cake, icing and fondant, and to maintain it&#39;s shape.                                                                         Once cooled and chilled, you can place them ontop of each other to form a sphere. They are held together by a layer of icing between them.  &lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Slide 3 - Fondant Icing:&lt;/font&gt;&lt;/b&gt; The fondant icing has to be rolled out on a special non-stick mat. We found that adding a bit of flour helped to reduce the stickiness.                                                                             There are special rollers which ensure that the thickness of the fondant is consistent throughout. You then have to cut them into square pieces (about 1 cm squares worked well for us).                                                                             The squares are then painted Silver with a special/edible silver fondant glaze. You may need to use a few coats, and allowing it to dry between coats.  &lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Slide 4 - Iced Cake on Base:&lt;/font&gt;&lt;/b&gt; The cake can either be iced on or off the base plate... probably better to do it off the base plate. But if you decide to do it on                                                                               the base plate, you will need to protect the LEDs from stray icing that may fall from the cake (in the process). Once the cake has been fully iced (with icing/frosting), you will need to place the cake                                                                               into the central position on the board. There may be a chance that the cake may slide from the base... so do what you need to do to make it stay put.   &lt;/li&gt;                     &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Slides 5-7 - Place Fondant Squares:&lt;/font&gt;&lt;/b&gt; While the icing is still soft, you will then need to quickly, methodically and tirelessly place the fondant                                                                                        squares in a horizontal linear pattern around the cake. Work your way towards the north and south poles of the cake doing one row at a time.                                                                                       You can cut a fondant circle for the north pole of the cake. In slide 7, you will see a hole at the top of the cake. This was made to cold a plastic canister                                                                                       inside, which would be used later the hold the decorations in place at the top of the cake. Do this before placing the fondant circle at the top of the cake.    &lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Slide 8 - Add Glitter:&lt;/font&gt;&lt;/b&gt; After placing all of the fondant squares onto the cake, it is very possible that some of the Silver glaze may have been wiped off some of the squares.                                                                          This is where you go over it again with a few more coats of silver glaze, and on the last coat, before it dries, you can sprinkle                                                                          some edible glitter all around the cake to give it that extra shine.  &lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Slide 9 - The end product:&lt;/font&gt;&lt;/b&gt; The final step is to add some wire sparklers and some other decorations to the top of the cake. Push the wires through the                                                                               fondant cap at the north pole into the canister within. This will hold the wires in place without ruining all of your hard work. &lt;/li&gt;        &lt;/ul&gt;      &lt;/P&gt;      &lt;br&gt;      &lt;P&gt;        &lt;h4&gt;LED Ring pins&lt;/h4&gt;      &lt;/P&gt;      &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPY5BparBlfj80J3tAsftpU5SFKXksU9_isccvMKqIib9lOmYaGIJCzI3gOOWPd3_S8gNoLCmNGlXfSUESQ4_-TFHLx2MWQV8A3Q9ejibQhfdzgXpkjqW4aHbIfHn1UGrzSRrtVLb6RZM/s1600/Slide22.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPY5BparBlfj80J3tAsftpU5SFKXksU9_isccvMKqIib9lOmYaGIJCzI3gOOWPd3_S8gNoLCmNGlXfSUESQ4_-TFHLx2MWQV8A3Q9ejibQhfdzgXpkjqW4aHbIfHn1UGrzSRrtVLb6RZM/s640/Slide22.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;      &lt;/P&gt;      &lt;P&gt;          &lt;ul&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;WS2812-B chipset: &lt;/font&gt;&lt;/b&gt; This LED ring uses the WS2812-B chipset, and has 4 break-out pins&lt;br&gt; (GND, 5V, Din, Dout)&lt;/li&gt;              &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Power: &lt;/font&gt;&lt;/b&gt; To power this module, you need to provide 5V and up to 1A of current&lt;/li&gt;            &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Signals: &lt;/font&gt;&lt;/b&gt; To control the LED ring, you need to send signals to it via the Digital Input pin (Din).              &lt;br&gt;You can connect another LED ring to this one by utilising the Digital Output pin (Dout)&lt;/li&gt;        &lt;/ul&gt;        &lt;br&gt; &amp;nbsp;       &lt;br&gt;      &lt;P&gt;        &lt;h4&gt;Power Usage Guide&lt;/h4&gt;      &lt;/P&gt;      &lt;P&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdnpmb2MwX25wJ0jG7TQhIHeihofM2VjfslZwHICoTLwEcnynVasjpQnbhf84rsCpFmn1GzGYOWCj4ZMr3zJcbveN5-_b28MNPGlSD3FTYqQ_4INVhd0t3yKu59ma5dQLbu6sS69Xbbfc/s1600/Slide57.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdnpmb2MwX25wJ0jG7TQhIHeihofM2VjfslZwHICoTLwEcnynVasjpQnbhf84rsCpFmn1GzGYOWCj4ZMr3zJcbveN5-_b28MNPGlSD3FTYqQ_4INVhd0t3yKu59ma5dQLbu6sS69Xbbfc/s640/Slide57.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;      &lt;P&gt;          &lt;ul&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;General Rule: &lt;/font&gt;&lt;/b&gt; Each individual LED on the ring can transmit Red, Green and Blue light.The combinations of these colours can make up any other colour.                                                                   White light is made up of all three of these colours at the same time. Each individual colour will draw approximately                                                                   20mA of current when showing that colour at maximum brightness. When shining white at maximum brightness, the single LED will draw                                                                   approximately 60mA.    &lt;/li&gt;              &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Power multiplier: &lt;/font&gt;&lt;/b&gt; If each LED can draw up to 60mA and there are 16 LEDs on a single LED ring, then 16x60mA = 960mA per LED ring. To be safe, and to make the maths easier, you need to make sure that                                                                     you provide enough current to accommodate 1A per LED ring. So 4 LED rings will need a 5V 4A power supply if you want to get full functionality out of the modules. &lt;/li&gt;        &lt;/ul&gt;        &lt;/P&gt;      &lt;br&gt;      &amp;nbsp; &lt;br&gt;      &lt;P&gt;        &lt;h4&gt;Fritzing diagram&lt;/h4&gt;      &lt;/P&gt;      &lt;P&gt;        &lt;!--Paste Fritzing picture here--&gt;        &lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Connecting ONE LED Ring to the Arduino&lt;/font&gt;&lt;/b&gt;- (Click to enlarge)&lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi12gT2hu_ltP07NKTI-RbCMmDW1EkE2egkOIi48qgl2EqqvOPco49tqw_Oxl2KzqfWkGBu9DQUmQSucgDXefiIaNpaszupsA7m588WUzF7i4R9tkgxIoDDIpyOIUt6hT8nGKLFBuNWfgE/s1600/Fritzing+1+board.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi12gT2hu_ltP07NKTI-RbCMmDW1EkE2egkOIi48qgl2EqqvOPco49tqw_Oxl2KzqfWkGBu9DQUmQSucgDXefiIaNpaszupsA7m588WUzF7i4R9tkgxIoDDIpyOIUt6hT8nGKLFBuNWfgE/s640/Fritzing+1+board.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;      &lt;/P&gt;      &lt;br&gt;      &lt;div id=&quot;Connecting One LED Ring&quot; style=&quot;text-align: justify;&quot;&gt;        &lt;P&gt;          &lt;ul&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;3 wires: &lt;/font&gt;&lt;/b&gt;You only need 3 wires to connect to the LED ring. If you only plan to light up a couple of LEDs at any one time this should be ok.&lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;The SAFE WAY: &lt;/font&gt;&lt;/b&gt;A safer way to do this is to use an external power supply to power both the Arduino and the LED ring.&lt;/li&gt;            &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Electrolytic capacitor: &lt;/font&gt;&lt;/b&gt;By connecting a large 4700 uF 16V Electrolytic capacitor between the positive and negative terminals of power supply leads, with the negative leg of the capacitor               attached to the negative terminal of the power supply, you will protect your LED rings from any initial onrush of current. &lt;/li&gt; &lt;br&gt;              &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdF7f7Q1NRAPgOSFSwKEM0cYCSEe0J03G31dOiaXkp8auOvbL_pjziI-MtRD30o6GYozVkjH9RwL7O5Ss7kNsT_QlU3DADQQZjQffmG0V6-SK9scmq9yvrxaHApKfJptmBSkb9oUKnaOw/s1600/Capacitor.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdF7f7Q1NRAPgOSFSwKEM0cYCSEe0J03G31dOiaXkp8auOvbL_pjziI-MtRD30o6GYozVkjH9RwL7O5Ss7kNsT_QlU3DADQQZjQffmG0V6-SK9scmq9yvrxaHApKfJptmBSkb9oUKnaOw/s640/Capacitor.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Protecting Resistor: &lt;/font&gt;&lt;/b&gt;It is also advisable to place a 300-400 ohm resistor between the Arduino&#39;s Digital Pin 9 (D9) and the LED Ring&#39;s Digital Input pin (Din). This protects the first LED from potential voltage spikes&lt;/li&gt;            &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Suitable wires: &lt;/font&gt;&lt;/b&gt;If you plan to chain a few of these LED rings together (see below), then you will probably want to keep the wires as short as possible and use a decent guage wire that can                handle the current being drawn through them.&lt;/li&gt;        &lt;/ul&gt;      &lt;/P&gt;      &lt;/div&gt;      &lt;br&gt; &amp;nbsp;       &lt;br&gt;      &lt;P&gt;        &lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Connecting TWO LED Rings to the Arduino&lt;/font&gt;&lt;/b&gt;- (Click to enlarge)&lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxzUEJB2oh4tnuWEdpPr_9qhUi8OceNgYjlO767Fs5tv-4ysM0xZWfRWHk0lCxqiPsUolwiFwxltfNvBiB0yG1-PcAcweUJxURX_znQUGn-RsbEPNCnVZIWrhARD6vMlbQZvQWcH_vgBI/s1600/Fritzing+2+boards.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxzUEJB2oh4tnuWEdpPr_9qhUi8OceNgYjlO767Fs5tv-4ysM0xZWfRWHk0lCxqiPsUolwiFwxltfNvBiB0yG1-PcAcweUJxURX_znQUGn-RsbEPNCnVZIWrhARD6vMlbQZvQWcH_vgBI/s640/Fritzing+2+boards.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;      &lt;/P&gt;      &lt;br&gt;      &lt;div id=&quot;Connecting Two LED Rings&quot; style=&quot;text-align: justify;&quot;&gt;        &lt;P&gt;          &lt;ul&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Three extra wires:&lt;/font&gt;&lt;/b&gt;You only need 3 extra wires to connect an additional LED ring. A wire needs to connect the Digital output (Dout) of the first LED ring to the Digital Input (Din) of the 2nd LED ring. &lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Stay safe:&lt;/font&gt;&lt;/b&gt; Once again, a safer way to do this is to use an external power supply, a large electrolytic capacitor at the terminals, and a 300-400 ohm resistor between the Arduino and the first LED ring&#39;s digital input pin.&lt;/li&gt;          &lt;/ul&gt;      &lt;/P&gt;      &lt;/div&gt;      &lt;br&gt; &amp;nbsp;       &lt;br&gt;      &lt;P&gt;        &lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Connecting FOUR LED Ring to the Arduino&lt;/font&gt;&lt;/b&gt;- (Click to enlarge)&lt;br&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu8TyIXb26szoHA5YGjix4o3gEkcu7Zz6m7nB7VASpJYxrGogUd32sQkL0EiY3fwjfuX8czp0AthhPsTYKhwfu3B0bskp2y-bA5hkTLbk-0nZ9UXRoFgkDVPIR-rlsEoMAeC2kaC5c4wQ/s1600/Fritzing+4+boards.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu8TyIXb26szoHA5YGjix4o3gEkcu7Zz6m7nB7VASpJYxrGogUd32sQkL0EiY3fwjfuX8czp0AthhPsTYKhwfu3B0bskp2y-bA5hkTLbk-0nZ9UXRoFgkDVPIR-rlsEoMAeC2kaC5c4wQ/s640/Fritzing+4+boards.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;             &lt;/P&gt;      &lt;br&gt;      &lt;div id=&quot;Connecting Four LED Rings&quot; style=&quot;text-align: justify;&quot;&gt;        &lt;P&gt;          &lt;ul&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Sixty Four LEDs:&lt;/font&gt;&lt;/b&gt;You need 3 extra wires for each additional LED ring. 4 LED rings provides a total of 64 LEDs.&lt;/li&gt;          &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;Watch the AMPS:&lt;/font&gt;&lt;/b&gt;At full brightness, this setup could potentially draw up to 4amps (or roughly 1 amp per LED ring)&lt;/li&gt;            &lt;li&gt;&lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;External Supply essential: &lt;/font&gt;&lt;/b&gt;It is essential to use an external power supply to power these LEDs when there are so many of them. If you don&#39;t use an external power supply and you accidentally                                         illuminate ALL of the LEDs, then you are likely to damage the microcontroller from excessive current draw.&lt;/li&gt;        &lt;/ul&gt;      &lt;/P&gt;        &lt;/div&gt;      &lt;br&gt;      &lt;P&gt;        &lt;h4&gt;Connection Tables&lt;/h4&gt;      &lt;/P&gt;      &lt;P&gt;        &lt;!--Paste Connection Table here--&gt;        &lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;How to connect ONE LED Ring to the Arduino&lt;/font&gt;&lt;/b&gt;- (Click to enlarge)&lt;br&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo1XNkJVAIDALe_kgfkV9g2HXzXyYoanTxs_SLY5C8JVshjQZ2UCmra846yTA84dU8moZOKZPG4L7LdhQ1q9qOi5rFs3GXY9ZjaT65ZJ34Ek3_0FyHTb1kFLta6ILHZemq48ObKc6uFZc/s1600/Connection+Table+1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo1XNkJVAIDALe_kgfkV9g2HXzXyYoanTxs_SLY5C8JVshjQZ2UCmra846yTA84dU8moZOKZPG4L7LdhQ1q9qOi5rFs3GXY9ZjaT65ZJ34Ek3_0FyHTb1kFLta6ILHZemq48ObKc6uFZc/s640/Connection+Table+1.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;        &lt;/div&gt;      &lt;/P&gt;      &lt;br&gt;      &lt;P&gt;          &lt;b&gt;&lt;font color=&quot;#E5AD24&quot;&gt;How to connect TWO LED Rings to the Arduino&lt;/font&gt;&lt;/b&gt;- (Click to enlarge)&lt;br&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhHZA8pUseaVmDn4bHIn8vpLY85XsWl9RI9ekd23XVZxR_8ebFkXLtEQcWHBoPQ-Jwy-54wiNOTbxGYQLzVNbqz7njexooKfSCE8la2urw0YxRZj78GNk4zYCTX8TM7RtdFZliPRxUuJc/s1600/Connection+Table+2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhHZA8pUseaVmDn4bHIn8vpLY85XsWl9RI9ekd23XVZxR_8ebFkXLtEQcWHBoPQ-Jwy-54wiNOTbxGYQLzVNbqz7njexooKfSCE8la2urw0YxRZj78GNk4zYCTX8TM7RtdFZliPRxUuJc/s640/Connection+Table+2.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;        &lt;/div&gt;      &lt;/P&gt;    &lt;/div&gt;    &lt;br&gt;  &amp;nbsp;     &lt;br&gt;    &lt;div id=&quot;Concluding comments&quot; style=&quot;text-align: justify;&quot;&gt;      &lt;P&gt;        &lt;h4&gt;Concluding comments&lt;/h4&gt;      &lt;/P&gt;      &lt;P&gt;        &lt;!--Write concluding comments below--&gt;        In this tutorial I showed you how to go about decorating a Disco Ball cake and also showed you how to use the RGB LED rings from ICStation.          If you look at the video you will see just how versatile these LED rings are. I would like to thank my wife for providing such an exciting project to work on, and ICStation for their collaborative efforts.         Please make sure to share this project with all of your friends and family. &lt;br&gt;        &amp;nbsp; &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJnx0DHVEhPnLdT_Z_d0qz4QetH1modr6apMLyUzSSjoEhQFWCfDJGaODu1Iuy8Pyr3s29TBbIfUtrEhOeVrBpRKekERZCY_KhuoHBw_wFgZDqHuwialQjK_QBQ4RQTeQEKVZRWcUcU84/s1600/Slide2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; width=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJnx0DHVEhPnLdT_Z_d0qz4QetH1modr6apMLyUzSSjoEhQFWCfDJGaODu1Iuy8Pyr3s29TBbIfUtrEhOeVrBpRKekERZCY_KhuoHBw_wFgZDqHuwialQjK_QBQ4RQTeQEKVZRWcUcU84/s640/Slide2.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;                          &lt;/P&gt;    &lt;/div&gt;       &lt;div&gt;&lt;!--separator --&gt;      &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;      &lt;br /&gt;    &lt;/div&gt;    &lt;br /&gt;    &lt;br /&gt;    &lt;div align=&quot;center&quot;&gt;    If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;    &lt;br /&gt;    &amp;nbsp;     &lt;br /&gt;    Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br /&gt;    Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br /&gt;    I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br /&gt;    Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.     &lt;/div&gt;    &lt;br /&gt;      &lt;div id=&quot;ArduinoBasics Project Page Link&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;P&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;    &lt;/P&gt;    &lt;/div&gt;                                                        &lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/7394212545484989680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2016/06/arduino-disco-ball-cake.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7394212545484989680'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7394212545484989680'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2016/06/arduino-disco-ball-cake.html' title='Arduino Disco Ball Cake'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/xObHSWpaT-k/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-4008749729763671497</id><published>2016-04-24T01:32:00.000+07:00</published><updated>2018-03-28T22:35:14.153+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Animation"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Hall Effect"/><category scheme="http://www.blogger.com/atom/ns#" term="I2C"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Magnet"/><category scheme="http://www.blogger.com/atom/ns#" term="Magzor"/><category scheme="http://www.blogger.com/atom/ns#" term="MDP"/><category scheme="http://www.blogger.com/atom/ns#" term="Mechanotronic Design Process"/><category scheme="http://www.blogger.com/atom/ns#" term="MEGA"/><category scheme="http://www.blogger.com/atom/ns#" term="Motor"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Strobe"/><category scheme="http://www.blogger.com/atom/ns#" term="Stroboscope"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Arduino Stroboscope Animation</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;&lt;!-- Title Page Graphic --&gt;  &lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFrpYemmKFus-VR_UJyH3jggCyl6E4CQF9818TGKjkq4kuGr-C_DImsz7QpheAlm6DHiIJmMAQYBNV5ASw9wEcByRUGm4tgKbjJSFs3ND_fbYvWeP79Grn1UXaxCu7W5kX4YFBC7xAF4M/s1600/Magzor+WebPage+Title.jpg&quot; imageanchor=&quot;1&quot;&gt;            &lt;img height=&quot;176&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFrpYemmKFus-VR_UJyH3jggCyl6E4CQF9818TGKjkq4kuGr-C_DImsz7QpheAlm6DHiIJmMAQYBNV5ASw9wEcByRUGm4tgKbjJSFs3ND_fbYvWeP79Grn1UXaxCu7W5kX4YFBC7xAF4M/s640/Magzor+WebPage+Title.jpg&quot; style=&quot;border: 3px double white;&quot; width=&quot;640&quot; /&gt;          &lt;/a&gt;        &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;b&gt;UPDATE: Magzor has just started a &lt;a href=&quot;https://www.kickstarter.com/projects/magzor/open-robotics-design-platform/&quot;&gt;Kickstarter campaign&lt;/a&gt;. Please check it out to get a good package deal on many of their components. Many of which were used in this tutorial.&lt;/b&gt; &lt;br /&gt; &amp;nbsp; &lt;br /&gt;This tutorial will show you how to build your own Stroboscopic Animator using Magzor&#39;s Mechanotronic Design Portal as a starting point.     Magzor Corporation is a business in California that is trying really hard to simplify robotic design. They want to enable users with     little to no engineering experience to design and manufacture a custom robot by themselves in a matter of hours.    &lt;br /&gt;&lt;b&gt;What is a stroboscope?&lt;/b&gt;  A stroboscope is an instrument that uses a strobe light to make a moving object look stationary…             We will use this feature to create an interesting 4 picture animation on a rotating disk.&lt;br /&gt;            &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;             &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1ms7qMjbeVFHcPL_2Ic60f2Iqu5LGp8MkSr6Tzkae1w7kBsI2ilJrJFaTFqKeR4yxXJpVnHzDjyn_5sanuGGq8i6exC5pQtsCuDFIBYPn_lovGv9uwrEOd8O8L7248diJeHF-_2nGUlc/s1600/Stroboscope+Animation.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1ms7qMjbeVFHcPL_2Ic60f2Iqu5LGp8MkSr6Tzkae1w7kBsI2ilJrJFaTFqKeR4yxXJpVnHzDjyn_5sanuGGq8i6exC5pQtsCuDFIBYPn_lovGv9uwrEOd8O8L7248diJeHF-_2nGUlc/s320/Stroboscope+Animation.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;            &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;             &lt;br /&gt;            Have a look at the video below to see the project in action, and the MDP process walk-through:            &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;  &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Video&lt;/h4&gt;&lt;br /&gt;     &lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/8kHsvy_bAmg?rel=0&amp;amp;showinfo=0&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;    &lt;br /&gt;&lt;br /&gt;&amp;nbsp;     &lt;br /&gt;&amp;nbsp;  &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Parts Required:&lt;/h4&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://store.arduino.cc/product/GBX00067&quot;&gt;Arduino MEGA (or compatible board)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/magzor-i2c-arduino-shield&quot;&gt;Magzor I2C Arduino Shield&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/magzor-mic-power-i2c-board&quot;&gt;Magzor MIC: Power and I2C board&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/magzor-mic-10x-gpio&quot;&gt;Magzor MIC: 10x GPIO&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/magzor-mic-2x-dc-motor-driver&quot;&gt;Magzor MIC: 2x DC Motor Driver&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/magzor-hall-effect-breakout&quot;&gt;Magzor Hall Effect Breakout&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/18-round-magnet&quot;&gt;Neodymium Magnet&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/magzor-led-board&quot;&gt;Magzor LED board&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/6v-2-5a-dc-planetary-geared-motor&quot;&gt;6V 2.5A DC Planetary Geared Motor&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.altronics.com.au/p/m8911a-powertran-5v-dc-4a-fixed-2.1mm-tip-appliance-plugpack/&quot;&gt;5V DC 4A Power supply&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://magzor.com/product/rj45-cable&quot;&gt;RJ45 cable&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://au.mouser.com/ProductDetail/MikroElektronika/MIKROE-511/&quot;&gt;Female to Female Jumper wire&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Misc items: scrap paper, wood, brackets, screws, single and double-sided tape, cardboard.&lt;/li&gt;&lt;br /&gt;   &lt;/ul&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&amp;nbsp;  &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Magzor Schematic Diagram&lt;/h4&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Click to zoom ...         &lt;/div&gt;&lt;br /&gt;&amp;nbsp;   &lt;!-- Fritzing Sketch here --&gt;  &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLSu4ekw6yPsfrttXOlhRDCoFRSEJiSpJXXkAWxlWmMxVVjxgCy7puRPUY0l-bAkWWAgcA16Ni-jyYIjubGPqHQNmv5y829EnFWnnBhwq2lpqWy9DlzsMDQypzE1ENBnDD_XFHobVCPO8/s1600/Magzor+Schematic.jpg&quot; imageanchor=&quot;1&quot;&gt;            &lt;img height=&quot;344&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLSu4ekw6yPsfrttXOlhRDCoFRSEJiSpJXXkAWxlWmMxVVjxgCy7puRPUY0l-bAkWWAgcA16Ni-jyYIjubGPqHQNmv5y829EnFWnnBhwq2lpqWy9DlzsMDQypzE1ENBnDD_XFHobVCPO8/s640/Magzor+Schematic.jpg&quot; style=&quot;border: 3px double white;&quot; width=&quot;640&quot; /&gt;        &lt;/a&gt; &lt;br /&gt;Further build instructions can be obtained by selecting the components in the Mechanotronics Design Portal within the &lt;a href=&quot;http://magzor.com/&quot;&gt;Magzor website&lt;/a&gt;.  Generating the build, and then selecting &quot;Setup Instructions&quot; tab at the top of the page. See video above to see this process in action.  &lt;br /&gt;&amp;nbsp;  &lt;br /&gt;&amp;nbsp;  &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Arduino Sketch&lt;/h4&gt;&lt;br /&gt;  Make sure to copy and paste the following code into your Arduino IDE. It doesn&#39;t seem to work directly from the browser.   You also need to install the Arduino Magzor I2C library ( &lt;a href=&quot;http://magzor.com/downloads/&quot;&gt; http://magzor.com/downloads/ &lt;/a&gt; )  &lt;br /&gt;  &lt;br /&gt;  &lt;script src=&quot;https://gist.github.com/ArduinoBasics/03e193b2b4d4993cf76f41a68d55b7a9.js&quot;&gt;&lt;/script&gt;    &lt;br /&gt;&lt;br /&gt;&amp;nbsp;  &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Putting it together&lt;/h4&gt;&lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;   &lt;br /&gt;&lt;div&gt;Arduino MEGA&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4PnGg8IFlczvUl9pId66JXBpFV344xmKCYHIhCMMc3jJU9TEA5XBL4UnK1C4BFoEqfzHkfc2FNYJQrlSd6Y7dvqyB_ViYS8kdl5VrHYVLKbc5pwsUedg5MviU-P5jJi46MbszAA61sVc/s1600/Slide+07_+Arduino+MEGA.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;            &lt;img height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4PnGg8IFlczvUl9pId66JXBpFV344xmKCYHIhCMMc3jJU9TEA5XBL4UnK1C4BFoEqfzHkfc2FNYJQrlSd6Y7dvqyB_ViYS8kdl5VrHYVLKbc5pwsUedg5MviU-P5jJi46MbszAA61sVc/s320/Slide+07_+Arduino+MEGA.JPG&quot; style=&quot;border: 3px double white;&quot; width=&quot;320&quot; /&gt;        &lt;/a&gt;&lt;/div&gt;&lt;br /&gt;          &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;         &lt;br /&gt;&lt;div&gt;Magzor I2C board&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcar6glw-coIkRNrC58W1II4ch84jO4owLGSG83l9BpDh42afGjMkMj0D2ACLXZ6y0Tzoasf9ET4o4BEwE2ng27DU6IF_BG2UUWLTSiIsQO8OSQeDBL4RetBLMPQ-8x41szsc5vecbIkU/s1600/Slide+10_I2C+Shield.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;                &lt;img height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcar6glw-coIkRNrC58W1II4ch84jO4owLGSG83l9BpDh42afGjMkMj0D2ACLXZ6y0Tzoasf9ET4o4BEwE2ng27DU6IF_BG2UUWLTSiIsQO8OSQeDBL4RetBLMPQ-8x41szsc5vecbIkU/s320/Slide+10_I2C+Shield.JPG&quot; style=&quot;border: 3px double white;&quot; width=&quot;320&quot; /&gt;            &lt;/a&gt;&lt;/div&gt;&lt;br /&gt;          &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;         &lt;br /&gt;&lt;div&gt;MIC Boards&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQrcHHLfC41eERN4Vqwh_pq8EiSUv2wmg66n5oRK1OGjxqkY93Tc5vsSzTJYVpLQ7B-tu-tk3P2wjLU4MoBZ8eNdtOl795YM3fdzXF_-llELJ0K_ut-0w4087URf1utT9a-O9iqfYov0Y/s1600/Slide+08_MICS.JPG&quot; imageanchor=&quot;1&quot;&gt;                &lt;img height=&quot;159&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQrcHHLfC41eERN4Vqwh_pq8EiSUv2wmg66n5oRK1OGjxqkY93Tc5vsSzTJYVpLQ7B-tu-tk3P2wjLU4MoBZ8eNdtOl795YM3fdzXF_-llELJ0K_ut-0w4087URf1utT9a-O9iqfYov0Y/s320/Slide+08_MICS.JPG&quot; style=&quot;border: 3px double white;&quot; width=&quot;320&quot; /&gt;            &lt;/a&gt;&lt;/div&gt;&lt;br /&gt;          &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;         &lt;br /&gt;&lt;div&gt;MIC Boards Assembled&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnPNa9iGUAXrQpIQY5Vpt1-ROxiqfofG_c-8aFjB5BQfqxVrLF3cbSI8a4NsivEZGXu276ydOhZ1x1nby3Am2vuJMy90PpIpLsNtdf-D0pFxZQ_-8gqOOo6yfXSapdAFlwGmGD3cU0Mes/s1600/Slide+09_MICS.JPG&quot; imageanchor=&quot;1&quot;&gt;                &lt;img height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnPNa9iGUAXrQpIQY5Vpt1-ROxiqfofG_c-8aFjB5BQfqxVrLF3cbSI8a4NsivEZGXu276ydOhZ1x1nby3Am2vuJMy90PpIpLsNtdf-D0pFxZQ_-8gqOOo6yfXSapdAFlwGmGD3cU0Mes/s320/Slide+09_MICS.JPG&quot; style=&quot;border: 3px double white;&quot; width=&quot;315&quot; /&gt;            &lt;/a&gt;&lt;/div&gt;&lt;br /&gt;          &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;         &lt;br /&gt;&lt;div&gt;Sensors, Modules and Shields - all put together&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiezibVRbANe7CJvLxcn2AqhOk101opC7CNRQIGBgOBiVAfJqQ55NEWfBvl0KheYhVHU-kEZY7EErlJwcYIFVYYAjZ7lSBISEWxu4F2Uidr5_sBaB1qjmKTvKxoD2E0Ds5YrvRsW-md3Wc/s1600/Slide+11_+Put+Shields+Together.JPG&quot; imageanchor=&quot;1&quot;&gt;                &lt;img height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiezibVRbANe7CJvLxcn2AqhOk101opC7CNRQIGBgOBiVAfJqQ55NEWfBvl0KheYhVHU-kEZY7EErlJwcYIFVYYAjZ7lSBISEWxu4F2Uidr5_sBaB1qjmKTvKxoD2E0Ds5YrvRsW-md3Wc/s320/Slide+11_+Put+Shields+Together.JPG&quot; style=&quot;border: 3px double white;&quot; width=&quot;320&quot; /&gt;            &lt;/a&gt;&lt;/div&gt;&lt;br /&gt;          &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;         &lt;br /&gt;&lt;div&gt;Motor with Bracket and Wire &lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSFfUEsLj3n7inNlYQewy2bwhNygAU5Znw3HQmFaI5VZMfQMfqk0UfZamZQhYld1MMppDRwq_ua3_qMSK6bZMvejIXjtsEl_5QXUTDW4bZiDnGqHxx6zM-L89ghIv3zW6EU0aY3fcX9zo/s1600/Motor+with+Bracket.JPG&quot; imageanchor=&quot;1&quot;&gt;            &lt;img height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSFfUEsLj3n7inNlYQewy2bwhNygAU5Znw3HQmFaI5VZMfQMfqk0UfZamZQhYld1MMppDRwq_ua3_qMSK6bZMvejIXjtsEl_5QXUTDW4bZiDnGqHxx6zM-L89ghIv3zW6EU0aY3fcX9zo/s320/Motor+with+Bracket.JPG&quot; style=&quot;border: 3px double white;&quot; width=&quot;320&quot; /&gt;        &lt;/a&gt;        &lt;/div&gt;&lt;br /&gt;          &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;         &lt;br /&gt;&lt;div&gt;Picture lined up with magnet on disk &lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlEVdEFIpeW_ndZfhcUN-nAtOw9ZFpCgT7T8VyfCIsLwH4Oo6q6TnG5TT-7kGuJnt20l7EvFyFWpZx0XDrGUk1eUd1pQ9BO8keHbynzu_rz9sOCl2IWJHfh-INi1eqyka7XbwfZvZLzjM/s1600/Magnet+Lining+up+with+Image+on+Disk+2.jpg&quot; imageanchor=&quot;1&quot;&gt;                &lt;img height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlEVdEFIpeW_ndZfhcUN-nAtOw9ZFpCgT7T8VyfCIsLwH4Oo6q6TnG5TT-7kGuJnt20l7EvFyFWpZx0XDrGUk1eUd1pQ9BO8keHbynzu_rz9sOCl2IWJHfh-INi1eqyka7XbwfZvZLzjM/s320/Magnet+Lining+up+with+Image+on+Disk+2.jpg&quot; style=&quot;border: 3px double white;&quot; width=&quot;320&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;&lt;br /&gt;          &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp;         &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;h2&gt;Stroboscopic Animation&lt;/h2&gt;&lt;br /&gt;&lt;br clear=&quot;all&quot; /&gt;&amp;nbsp;         &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1ms7qMjbeVFHcPL_2Ic60f2Iqu5LGp8MkSr6Tzkae1w7kBsI2ilJrJFaTFqKeR4yxXJpVnHzDjyn_5sanuGGq8i6exC5pQtsCuDFIBYPn_lovGv9uwrEOd8O8L7248diJeHF-_2nGUlc/s1600/Stroboscope+Animation.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border: 3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1ms7qMjbeVFHcPL_2Ic60f2Iqu5LGp8MkSr6Tzkae1w7kBsI2ilJrJFaTFqKeR4yxXJpVnHzDjyn_5sanuGGq8i6exC5pQtsCuDFIBYPn_lovGv9uwrEOd8O8L7248diJeHF-_2nGUlc/s320/Stroboscope+Animation.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;         &lt;br /&gt;&lt;br clear=&quot;all&quot; /&gt;&amp;nbsp;   &lt;/div&gt;&lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The Arduino MEGA microcontroller listens for the hall effect sensor to be triggered by the south facing side of the magnet on the underside of the rotating disk.         As the magnet moves over the hall effect sensor, the sensor is triggered and the Arduino instructs the LED to blink for a fraction of a second.         By manipulating the delay after the trigger time,  we can get the LED to blink when one of the four images on the rotating disk is towards the front position.         And if we get the timing right, we can make a simple animation.  &lt;br /&gt;&amp;nbsp;         &lt;br /&gt;If you watch the video above, you will see that the image bounces around a little bit. The duration of each frame is determined by the speed of the rotating disk (or motor), and the number of LED flashes per frame.         Any changes in rotation speed will affect the position of the picture when the LED blinks. My rotating disk is not completely semetrical or centred correctly, and therefore a bit jumpy… but you get the idea.         Bold images with high contrast seem to work best… Precision is key for this type of project. And if you can get the disk to rotate at a constant speed, you could probably do away with the hall effect sensors and magnets…         however, in my case, these were essential in getting the project to work as intended.  &lt;br /&gt;&amp;nbsp;         &lt;br /&gt;This project is a lot of fun. You can really get creative by making your own pictures or 3 dimensional models (for a stop motion effect). Try different colours. It really is quite cool.&lt;/div&gt;&lt;br /&gt;&lt;!--separator --&gt;    &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;h4&gt;Concluding Comments&lt;/h4&gt;&lt;br /&gt;I would like to thank Magzor for supplying the components used in this tutorial, and letting me try out their MDP process. I really like the concept, the one stop shop which looks after you from beginning to end. Providing everything I needed to get the project off the ground.  The point of this exercise was to go through the entire process of selecting the parts, build the project, and get it up and running. And I have done that in no time at all.  &lt;br /&gt;&amp;nbsp;             &lt;br /&gt;There is only one library to download and install,  and the good thing is that you don&#39;t have to go hunting for it. The latest &quot;correct&quot; working version of the library is easy to find, right there on the &lt;a href=&quot;http://magzor.com/&quot;&gt;Magzor website…&lt;/a&gt;              Speaking of the Magzor website, please make sure to take a quick look around. It is quite impressive.  &lt;br/&gt;  &amp;nbsp;  &lt;br clear=&quot;all&quot; /&gt;  &amp;nbsp; &lt;b&gt;UPDATE: Magzor has just started a &lt;a href=&quot;https://www.kickstarter.com/projects/magzor/open-robotics-design-platform/&quot;&gt;Kickstarter campaign&lt;/a&gt;. Please check it out to get a good package deal on many of their components. Many of which were used in this tutorial.&lt;/b&gt;        &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align=&quot;center&quot;&gt;If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;    &lt;br /&gt;Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br /&gt;Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br /&gt;I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br /&gt;Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;  &lt;br /&gt;&amp;nbsp;  &lt;br /&gt;&amp;nbsp;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align=&quot;center&quot;&gt;This project would not have been possible without the collaborative effort from &lt;a href=&quot;http://magzor.com/&quot;&gt;Magzor Corporation&lt;/a&gt;.&lt;br /&gt;Please visit their site and check out the MDP.&lt;/div&gt;&lt;br /&gt; &lt;div&gt;&lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/div&gt;However, if you do not have a google profile... &lt;br /&gt;Feel free to share this page with your friends in any way you see fit.  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/4008749729763671497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2016/04/arduino-stroboscope-animation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4008749729763671497'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4008749729763671497'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2016/04/arduino-stroboscope-animation.html' title='Arduino Stroboscope Animation'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFrpYemmKFus-VR_UJyH3jggCyl6E4CQF9818TGKjkq4kuGr-C_DImsz7QpheAlm6DHiIJmMAQYBNV5ASw9wEcByRUGm4tgKbjJSFs3ND_fbYvWeP79Grn1UXaxCu7W5kX4YFBC7xAF4M/s72-c/Magzor+WebPage+Title.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-8286957717544493870</id><published>2015-12-16T14:49:00.000+07:00</published><updated>2018-03-28T22:35:14.249+07:00</updated><title type='text'>Circuit Diagram</title><content type='html'>I just came across this site today (&lt;a href=&quot;http://www.schematics.com&quot;&gt;www.schematics.com&lt;/a&gt;).It looks pretty impressive !! &lt;br&gt;Schematics.com allows you to &quot;build, share and view schematics from you browser&quot; &lt;br&gt;You can also embed your schematic creations on your website - which is neat.&lt;P&gt;&lt;br&gt; &amp;nbsp; &lt;iframe width=&#39;500&#39; height=&#39;300&#39; frameborder=&#39;0&#39; scrolling=&#39;no&#39; src=&#39;http://www.schematics.com/embed/led-with-switch-25024&#39;&gt;&lt;/iframe&gt;&lt;br&gt; &amp;nbsp; &lt;br&gt; &amp;nbsp; &lt;br&gt; &amp;nbsp; &lt;a href=&quot;http://www.schematics.com&quot;&gt;Circuit Diagram&lt;/a&gt; - Schematics is the language of electronics. It provides a concise and comprehensive diagrammatic description of a circuit. Schematics.com allows users to connect and share designs and ideas in a like-minded community. &lt;br&gt; &amp;nbsp; &lt;br&gt; &amp;nbsp; &lt;br&gt; &amp;nbsp; </content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/8286957717544493870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/12/circuit-diagram.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/8286957717544493870'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/8286957717544493870'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/12/circuit-diagram.html' title='Circuit Diagram'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-4615168440143931874</id><published>2015-11-16T22:31:00.000+07:00</published><updated>2018-03-28T22:35:14.344+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="AnalogRead"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino UNO"/><category scheme="http://www.blogger.com/atom/ns#" term="data"/><category scheme="http://www.blogger.com/atom/ns#" term="Ethernet"/><category scheme="http://www.blogger.com/atom/ns#" term="ioShield-A"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="Port Forwarding"/><category scheme="http://www.blogger.com/atom/ns#" term="Web Server"/><category scheme="http://www.blogger.com/atom/ns#" term="WIZ550io"/><category scheme="http://www.blogger.com/atom/ns#" term="WIZnet"/><title type='text'>Get Arduino Data over the internet using jQuery and AJAX</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/gF41GRUzFyA?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;      &lt;/div&gt;    &lt;/P&gt;  &lt;div&gt;    &lt;P&gt;      &lt;H4&gt;Description&lt;/H4&gt;    &lt;/P&gt;    &lt;P&gt;       Have you ever wanted to transmit Arduino data over the internet? &lt;br /&gt;         &lt;br&gt;       In this tutorial, we will design a web page that will retrieve Analog readings from the Arduino&#39;s Analog Pins and display them on a bar chart within the web page. &lt;br&gt;       &lt;br&gt;       The web page will use jQuery and AJAX to request the data from the Arduino Web Server, allowing us to update the bar chart dynamically, without having to refresh the entire web page.        The Arduino Web Server will send the Analog readings to the web page in JSON format where it will be processed and displayed accordingly. &lt;br&gt;       &lt;br&gt;       In this tutorial, I will not have anything connected to the Arduino&#39;s Analog pins, which means the data retrieved will be that of randomly floating analog pins. Feel free to connect a potentiometer, temperature sensor         or any other analog sensor to these pins if you want to create a more &quot;useful&quot; project. &lt;br&gt;       &lt;br&gt;       The main aim here was to show you how to transmit the data in JSON format, and to update only a portion of the web page using asynchronous communication (using AJAX), to improve the performance of data retrieval and visualisation.     &lt;/P&gt;  &lt;/div&gt;  &lt;/div&gt;&lt;br&gt;&lt;div&gt;  &lt;P&gt;    &lt;h4&gt;Parts Required:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;ul&gt;      &lt;li&gt;&lt;a href=&quot;https://store.arduino.cc/product/GBX00066&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.shopwiznet.com/ioshield-a&quot;&gt;WIZnet ioShield-A ver 1.1&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.shopwiznet.com/wiz550io&quot;&gt;WIZnet WIZ550io shield ver 1.1&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt;  &lt;/P&gt;  &lt;P&gt;&lt;span style=&quot;color:red&quot;&gt;Please note:&lt;/span&gt; The WIZnet ioShield-A ver1.1 actually comes with the WIZ550io board. So if you buy the ioShield-A, you will receive both boards. I have provided the link to the WIZ550io shield because you can buy that shield on its own. Regardless, you will need to use both boards for this tutorial.&lt;/P&gt;&lt;/div&gt;&lt;br&gt;&lt;div&gt;  &lt;P&gt;    &lt;h4&gt;Arduino Libraries and IDE&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;      To program the Arduino you will need to download the Arduino IDE, and install the WIZnet Ethernet Library.      The Arduino IDE version used in this tutorial was version 1.6.4. &lt;br&gt;      You may want to read the WIZnet wiki information for each WIZnet shield before use.   &lt;/P&gt;  &lt;P&gt;    &lt;ul&gt;      &lt;li&gt;&lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/Wiznet/WIZ_Ethernet_Library&quot;&gt;WIZnet Ethernet Library&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://wizwiki.net/wiki/doku.php?id=osh:ioshield-a:singlepage&quot;&gt;ioShield-A setup instructions&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://wizwiki.net/&quot;&gt;WIZnet Wiki page&lt;/a&gt; - for more information about the ioShield-A and the WIZ550io shield&lt;/li&gt;    &lt;/ul&gt;  &lt;/P&gt;&lt;/div&gt;&lt;br&gt; &amp;nbsp; &lt;br&gt;&lt;div id=&quot;Arduino Code&quot;&gt;  &lt;P&gt;    &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;script src=&quot;https://gist.github.com/ArduinoBasics/9b68159d6e8308254eb8e3f4a4b1c183.js&quot;&gt;&lt;/script&gt;  &lt;/P&gt;&lt;/div&gt;&lt;div id=&quot;Arduino Code Description&quot;&gt;  &lt;P&gt;    Full description of the Arduino code is included in the &lt;a href=&quot;http://www.youtube.com/watch?v=gF41GRUzFyA&amp;t=7m41s&quot;&gt;YouTube video&lt;/a&gt; above.     Once you have set up your Arduino Web Server, you should be able to ping it.  Look at this website, if you don&#39;t know how to use the windows ping feature.        &lt;/P&gt;&lt;/div&gt;&lt;br&gt;&lt;div id=&quot;Hooking it up&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Getting the Arduino Board onto the internet:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    There isn&#39;t anything really to hook up for this project. You just have to align the pins for each board and stack them. You can power the Arduino via the USB cable.     This will also be useful for debugging and printing to the Serial monitor. An ethernet cable needs to connect the WIZ550io board&#39;s ethernet port to your internet/network router&lt;br&gt;    &lt;ul&gt;      &lt;li&gt;The WIZ550io board goes on the top&lt;/li&gt;      &lt;/ul&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG9QK918HJXl3kzme0gPX-G1bg1_C08bw9tgo7lqkToj9kDStH_RbVfsolXjJiVJEN-bx9ZBCOhJDOFcm6T2W9OEhomK_PAYtrQhH_6jmsPYWwzt8GT5QGmAEhpnTL6ImYtrxHhYCTeTk/s1600/WIZ2550io_Pic1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;WIZ550io Shield&quot; title=&quot;WIZ550io Shield&quot; style=&quot;border:2px solid white;&quot; height=&quot;432&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG9QK918HJXl3kzme0gPX-G1bg1_C08bw9tgo7lqkToj9kDStH_RbVfsolXjJiVJEN-bx9ZBCOhJDOFcm6T2W9OEhomK_PAYtrQhH_6jmsPYWwzt8GT5QGmAEhpnTL6ImYtrxHhYCTeTk/s640/WIZ2550io_Pic1.jpg&quot; width=&quot;640&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;    &lt;ul&gt;      &lt;li&gt;The ioShield-A is in the middle &lt;/li&gt;      &lt;/ul&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ1cTkAdc0wugOIKWVnL1jRJy6Vvh4rVBuuBxvclQJUs17c7BpBeehrXOfa3lsK4avHm7OwPxvKzP8lPwNQRlEfqJxtXXHjW-tPbwpBvcANpEPD0vD8jfbmCGZVAUthBQfguNaJ5KTrRI/s1600/ioShieldA_Pic2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;WIZnet ioShield-A ver 1.1&quot; title=&quot;WIZnet ioShield-A ver 1.1&quot; style=&quot;border:2px solid white;&quot; height=&quot;470&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ1cTkAdc0wugOIKWVnL1jRJy6Vvh4rVBuuBxvclQJUs17c7BpBeehrXOfa3lsK4avHm7OwPxvKzP8lPwNQRlEfqJxtXXHjW-tPbwpBvcANpEPD0vD8jfbmCGZVAUthBQfguNaJ5KTrRI/s640/ioShieldA_Pic2.jpg&quot; width=&quot;640&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;    &lt;ul&gt;        &lt;li&gt; The Arduino UNO is on the bottom &lt;/li&gt;      &lt;/ul&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgV3hVfc5mDKtobx-uQQILsBm0EDOqq9fOpeMCJ8P4RtzRNqOisvWbMHgulCTR2Eo54C4a_Y6APStzqMnuwTqfNoQ0hOyHEOA3NYiSYKqYIj_Vh_sk3CuQitMQ1puF1soiw922QdSeDLA/s1600/Arduino+UNO.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Arduino UNO&quot; style=&quot;border:2px solid white;&quot; height=&quot;410&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgV3hVfc5mDKtobx-uQQILsBm0EDOqq9fOpeMCJ8P4RtzRNqOisvWbMHgulCTR2Eo54C4a_Y6APStzqMnuwTqfNoQ0hOyHEOA3NYiSYKqYIj_Vh_sk3CuQitMQ1puF1soiw922QdSeDLA/s640/Arduino+UNO.jpg&quot; title=&quot;Arduino UNO&quot; width=&quot;640&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;    &lt;ul&gt;      &lt;li&gt; This is what it looks like when they are stacked together &lt;/li&gt;      &lt;/ul&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghIV6Zv5wmfeIpsoi5dn3DejbdrwKsBVeaPMGeK3Zx-R6hics9xTW8lquUQQqDbignPPbdFqgtvCriFz0ZSzvwSHvBYL11Bsir8dIM6zu4brgcC0aYlM9eZjyB0iFoASk-D4XsTPrMPfM/s1600/Arduino+and+Shields+stacked+together+and+cables+connected.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Arduino UNO plus ioShield-A plus WIZ550io shield&quot; style=&quot;border:2px solid white;&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghIV6Zv5wmfeIpsoi5dn3DejbdrwKsBVeaPMGeK3Zx-R6hics9xTW8lquUQQqDbignPPbdFqgtvCriFz0ZSzvwSHvBYL11Bsir8dIM6zu4brgcC0aYlM9eZjyB0iFoASk-D4XsTPrMPfM/s640/Arduino+and+Shields+stacked+together+and+cables+connected.jpg&quot; title=&quot;Arduino UNO plus ioShield-A plus WIZ550io shield&quot; width=&quot;640&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;    &lt;ul&gt;      &lt;li&gt;If you want to gain easy access to the Analog or digital pins without de-soldering the ioShield-A, you can introduce some female headers like this:&lt;/li&gt;    &lt;/ul&gt;         &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJ74lBYAAsrkdiycEJhD3ehKFPTooWtkNfSRYlpcm7FfrZJfiSNkQ4A1RK38BkwzbsJu9f3Bo7l6Kie1DmGCCfzPFehaF7PFucvR7edkPhmozZdm7kXR8gYrOHCymgJfA1ZLWRuKG0djI/s1600/Arduino+UNO+with+female+headers.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Arduino UNO with some extra Female headers&quot; style=&quot;border:2px solid white;&quot; height=&quot;428&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJ74lBYAAsrkdiycEJhD3ehKFPTooWtkNfSRYlpcm7FfrZJfiSNkQ4A1RK38BkwzbsJu9f3Bo7l6Kie1DmGCCfzPFehaF7PFucvR7edkPhmozZdm7kXR8gYrOHCymgJfA1ZLWRuKG0djI/s640/Arduino+UNO+with+female+headers.jpg&quot; title=&quot;Arduino UNO with some extra Female headers&quot; width=&quot;640&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;    &lt;ul&gt;      &lt;li&gt;Please note that the &lt;a href=&quot;http://wizwiki.net/wiki/doku.php?id=osh:ioshield-a:start&quot;&gt;ioShield-A&lt;/a&gt; utilises a number of pins on the Arduino UNO - including: D2, D4, D7, D10, GND, and IOREF, RESET, 5V, GND, GND and ICSP pins &lt;/li&gt;      &lt;li&gt;All Analog pins are available for use &lt;/li&gt;      &lt;/ul&gt;    &lt;/P&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt;  &lt;P&gt;&lt;H4&gt;Set the Arduino Web Server on your local network&lt;/h4&gt;&lt;/P&gt;  &lt;P&gt;     You can test this project on your local network. You just have to choose an available IP address and PORT within your router&#39;s IP range.      If you don&#39;t know your local IP address range - you can have a look at &lt;a href=&quot;http://portforward.com/networking/routers_ip_address.htm&quot;&gt;this site &lt;/a&gt; to give you a helping hand.   &lt;/P&gt;  &lt;br&gt;    &lt;P&gt;&lt;h4&gt;Set the Arduino Web Server to be accessed from anywhere in the world&lt;/h4&gt;&lt;/P&gt;  &lt;P&gt;If you want to access your Arduino from anywhere in the world, you need to set up Port Forwarding on your internet network router.       The following useful guides will hopefully get you on the right track, if you have never set up Port forwarding.       &lt;ul&gt;             &lt;li&gt;&lt;a href=&quot;http://portforward.com/help/portforwarding.htm&quot;&gt;What is Port Forwarding&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://portforward.com/english/routers/port_forwarding/routerindex.htm&quot;&gt;portforward.com&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://portforward.com/english/routers/port_forwarding/iiNet/BoB2/defaultguide.htm&quot;&gt;Example of how to port forward on the iiNet BOB2 router&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.pcworld.com/article/244314/how_to_forward_ports_on_your_router.html&quot;&gt;PC World instructions on how to port forward&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Kp-R-eHiQco&quot;&gt;YouTube video on how to set up port forwarding&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;  &lt;/P&gt;  &lt;br&gt;    &lt;P&gt; In my case, I programmed the Arduino UNO Web Server to take the following ip address on my internal network: &lt;b&gt;10.1.1.99 &lt;/b&gt;&lt;br&gt;    &lt;br&gt;      I programmed the Arduino Web Server to listen for Web Browsers on &lt;b&gt;port 8081&lt;/b&gt;.       &lt;br&gt;      So if I wanted to connect to the Arduino Web Server through my home network, I just had to type in this web address into my web browser: &lt;a href=&quot;http://10.1.1.99:8081&quot;&gt;http://10.1.1.99:8081&lt;/a&gt;&lt;br&gt;        &lt;br&gt;      If you plan to connect to the Arduino using port 80 (which is the default port for web browsers), you can just type the IP address without specifying the port (eg. http://10.1.1.99/ ) &lt;br&gt;        &lt;br&gt;      The web browser should display the Arduino data in JSON format (the &lt;a href=&quot;http://www.youtube.com/watch?v=gF41GRUzFyA&amp;t=23m20s&quot;&gt;YouTube video above&lt;/a&gt; will show you what that looks like).&lt;br&gt;        &lt;br&gt;      Once I knew I could connect to the Arduino in my internal network, I then set up port forwarding on my router so that I could type in my external IP address and special port to tunnel my way into       my Arduino Web Server on my internal network. This is what I had to do on my router, but you may need to do something different.&lt;br&gt;      &lt;ol&gt;      &lt;li&gt; My first step was to find out my public/external IP address by typing &quot;what is my IP address&quot; into google. If you want to know your external IP address &lt;a href=&quot;http://lmgtfy.com/?q=What+is+my+IP+address&quot;&gt;click here&lt;/a&gt;.&lt;/li&gt;      &lt;li&gt; I then typed my router&#39;s ip address into a web browser, and logged into my router. &lt;/li&gt;      &lt;li&gt; I went to the advanced settings tab &lt;/li&gt;      &lt;li&gt; Selected &quot;Port Forwarding&quot; from the side menu &lt;/li&gt;        &lt;li&gt; Filled out all of the details on the first line of the Ports list &lt;br&gt;           &lt;ul&gt;              &lt;li&gt;Enable box = ticked  &lt;/li&gt;              &lt;li&gt;Description = Arduino&lt;/li&gt;                &lt;li&gt;WAN interface = pppoe_atm0/ppp0&lt;/li&gt;              &lt;li&gt;Inbound port = 8082&lt;/li&gt;              &lt;li&gt;Type = TCP&lt;/li&gt;              &lt;li&gt;Private IP address = 10.1.1.99&lt;/li&gt;              &lt;li&gt;Private port = 8081&lt;/li&gt;            &lt;/ul&gt;&lt;/li&gt;         &lt;li&gt;Saved the settings&lt;/li&gt;      &lt;/ol&gt;      &lt;br&gt;      Now that I had port forwarding enabled, I could type the ip address (that I obtained in step 1) into my browser and specified port 8082 (instead of 8081) - eg. http://190.11.70.253:8082/&lt;br&gt;      &lt;br&gt;      And now I can access my Arduino Web server from anywhere in the world. I can even access it from my smart phone. Once again, this will only return the Analog data in JSON format.   &lt;/P&gt;&lt;/div&gt;&lt;br&gt;&lt;div&gt;&lt;P&gt;&lt;h4&gt;The Web Page GUI&lt;/h4&gt;&lt;/P&gt;&lt;P&gt;The Arduino is now on the internet, so there are two options. You can either &lt;br&gt;   &lt;ul&gt;   &lt;li&gt;go to this web page: &lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduinobasics.html&quot;&gt;ArduinoBasics Webserver Data Viewer&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;or create the web page yourself (with a little help from the HTML code below)     &lt;/ul&gt;&lt;/P&gt;&lt;P&gt;Instructions on how to use these web pages, are listed below the HTML code.&lt;/P&gt;&lt;/div&gt;&lt;br&gt;&lt;div id=&quot;Web page code&quot;&gt;&lt;script src=&quot;https://gist.github.com/ArduinoBasics/bcc517e4e5493654d947.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;&lt;br&gt;&lt;div&gt;&lt;P&gt;  To retrieve data from your Arduino Web Server, please make sure that it is connected and visible from outside of you local network. You will need to have port forwarding enabled.   Information on port forwarding is described above.    &lt;ol&gt;    &lt;li&gt;Find what your external IP address is. &lt;/li&gt;    &lt;li&gt;Enter this address using the IP address drop-down boxes within the &lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduinobasics.html&quot;&gt;&quot;ArduinoBasics Webserver Data viewer&quot;&lt;/a&gt; web page&lt;/li&gt;    &lt;li&gt;Enter the port forwarding port number (eg. 8082) into the box labelled &quot;Port&quot;&lt;/li&gt;    &lt;li&gt;Then click on the &quot;Click here to start getting data&quot; button - you should start to see the bar charts moving and status should be OK&lt;/li&gt;    &lt;li&gt;If the bar charts do not move, and the status message says &quot;Failed to get DATA!!&quot; - then the web page was unable to connect to the Arduino for some reason. &lt;/li&gt;  &lt;/ol&gt;&lt;/P&gt;&lt;br&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduinobasics.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;ArduinoBasics Web Data Viewer Web Page Example&quot; style=&quot;border:2px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVEkeZwx6aV-0QDG9Zg9xhaqqOu8JE6HjMU0zvanzxrBLPf1k4YU7ips1F9sDkt3hRBtfv3ZsMlJxNI_YJ6rdTiAcLJQFlr67aC1VyfMJSAbX_84vM9MGSvi1Pa7yNWDWZYR7yQu_ozUA/s640/ArduinoBasics+Web+Data+Viewer.jpg&quot; title=&quot;ArduinoBasics Web Data Viewer Web Page Example&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br&gt;&lt;h4&gt;Troubleshooting&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;You may want to type in the web address into your web browser, to make sure that data is being retrieved. &lt;/li&gt;&lt;li&gt;You can also open the Serial monitor in the Arduino IDE to make sure that an IP address is being displayed&lt;/li&gt;&lt;li&gt;Ensure that you have enabled the port forwarding option on your router&lt;/li&gt;&lt;li&gt;Have a look at &lt;a href=&quot;http://www.youtube.com/watch?v=gF41GRUzFyA&amp;t=21m45s&quot;&gt;Developer Tools within Google Chrome&lt;/a&gt; to help diagnose web page related issues.  &lt;li&gt;The web page will not work properly if you use Internet Explorer or if you have javascript disabled within your browser. &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br&gt;&lt;div id=&quot;Concluding comments&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Concluding comments&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    This tutorial showed you how to connect to your Arduino UNO over the internet, and retrieve data in JSON format using jQuery and AJAX.     The web page can be modified to suit your own needs, plus it would be more useful if the Arduino was actually monitoring something, rather than logging data from floating pins.     It would also be useful if the Arduino could be controlled to blink an LED, or to turn a motor... but I will leave that project for another day.     I hope you enjoyed this tutorial - if it helped you in any way, please consider donating a small &quot;tip&quot; into my &lt;a href=&quot;https://www.generosity.com/fundraisers/digital-storage-oscilloscope/&quot;&gt;money jar&lt;/a&gt;. Thank you.   &lt;/P&gt;&lt;/div&gt; &lt;br&gt;&lt;div id=&quot;Social Engagement&quot; align=&quot;center&quot;&gt;  &lt;P&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;    &lt;/P&gt;&lt;/div&gt;  &lt;div id=&quot;ArduinoBasics Project Page Link&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;  &lt;P&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot;&gt;&lt;/a&gt;  &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;OpenLab Link&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;  &lt;P&gt;    This project would not have been possible without &lt;a href=&quot;http://www.wiznet.co.kr/&quot;&gt;WIZnet&#39;s&lt;/a&gt; collaborative effort.&lt;br&gt;    Please visit their site for more cool Ethernet products.          &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Separator2&quot;&gt;  &lt;P&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Final social hint&quot;&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/div&gt;       &lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/4615168440143931874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/11/get-arduino-data-over-internet-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4615168440143931874'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4615168440143931874'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/11/get-arduino-data-over-internet-using.html' title='Get Arduino Data over the internet using jQuery and AJAX'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/gF41GRUzFyA/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-543877878191040856</id><published>2015-10-13T07:43:00.000+07:00</published><updated>2018-03-28T22:35:14.451+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="arduino code example"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="Box"/><category scheme="http://www.blogger.com/atom/ns#" term="FastLED"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Light"/><category scheme="http://www.blogger.com/atom/ns#" term="NeoPixels"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Arduino LED Light Box</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;div id=&quot;YouTube&quot; style=&quot;text-align: justify;&quot;&gt;    &lt;P&gt;      &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/c2Q7lFYFGFY?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;      &lt;/div&gt;    &lt;/P&gt;  &lt;/div&gt; &lt;div id=&quot;Description&quot; style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;H4&gt;Description&lt;/H4&gt;  &lt;/P&gt;  &lt;P&gt;    Long straight lines of LED luminescence is nice, but sometimes you may want to light up something that has an unusual shape, or is not so linear.     This is where the &lt;a href=&quot;http://openlab.com.au/shop/12mm-diffused-flat-digital-rgb-led-pixels-strand-of-25/&quot;&gt;12mm diffused flat digital RGB LED Pixels&lt;/a&gt; can come into play.     This cool strand of 25 RGB LED pixels fit nicely into 12mm pre-drilled holes of any material you like.    &lt;/P&gt;     &lt;P&gt;    This tutorial is dedicated to making a LED Light Box. I wanted the box to be equally as interesting during the day as it was at night. If you decide you make your own,     feel free to be as creative as you want !! However, if you lack artistic acumen, you may need to source a minion or two.   &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Parts Required&quot; style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Parts Required:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;ul&gt;        LED Circuit:       &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/50&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/738&quot;&gt;12mm Diffused Flat Digital RGB LED Pixels (Strand of 25)&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.altronics.com.au/p/m8911a-powertran-5v-dc-4a-fixed-2.1mm-tip-appliance-plugpack/&quot;&gt;PowerTran 5V DC 4A Plugpack with 2.1mm tip&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.altronics.com.au/p/p0610-2.1mm-screw-terminal-male-dc-power-line-socket/&quot;&gt;2.1mm Screw Terminal, DC Power Line socket&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/65&quot;&gt;Breadboard&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/153&quot;&gt;Breadboard jumper wire&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://www.sparkfun.com/products/11507&quot;&gt;330 ohm resitor&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Passive-Components/Capacitors/Electrolytic/4700uF-16V-RB-Electrolytic-Capacitor---105oC/p/RE6243&quot;&gt;4700uF 16V Electrolytic Capacitor (Jaycar Cat No. RE6243)&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Interconnect/Terminals-%26-Headers/Pluggable-Terminal-Blocks/6-Pole-PC-Mount-Pluggable-Header---5-08mm---Horizontal/p/HM3106&quot;&gt;6 Pole PC Mount Pluggable Header (Jaycar Cat No. HM3106)&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Interconnect/Terminals-%26-Headers/Pluggable-Terminal-Blocks/6-Pole-PC-Mount-Pluggable-Terminal-Block-Socket---5-08mm/p/HM3126&quot;&gt;6 Pole PC Mount Pluggable Terminal Block Socket (Jaycar Cat No. HM3126)&lt;/a&gt;&lt;/li&gt;       &lt;br&gt;              Project Box:       &lt;li&gt;&lt;a href=&quot;http://www.bunnings.com.au/boyle-medium-craft-timber-box-with-catch_p1660859&quot;&gt;Boyle Medium Craft Timber Box With Catch&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.bunnings.com.au/irwin-12mm-speedbor-spade-drill-bit-_p6354271&quot;&gt;12mm drill bit (and drill)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.officeworks.com.au/shop/officeworks/p/elc-acrylic-paint-antique-white-100ml-el0831?searchTerm=ELC%20acrylic%20paint&quot;&gt;ELC Acrylic Paint Antique White 100mL&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://micador.com.au/Product/779/Micador-Acrylic-Paint-Sets&quot;&gt;Micador Acrylic Paint Sets&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.officeworks.com.au/shop/officeworks/p/j-burrows-acrylic-paint-200ml-glitter-sugar-cube-ja401070&quot;&gt;J.Burrows Acrylic Paint 200mL Glitter Sugar Cube&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.officeworks.com.au/shop/officeworks/p/elc-rhinestone-assorted-500-pack-el0875?searchTerm=rhinestone%20mix&quot;&gt;ELC Rhinestone Assorted 500 Pack&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt;  &lt;/P&gt;&lt;/div&gt;  &lt;br&gt; &amp;nbsp;  &lt;br&gt;  &lt;div id=&quot;Arduino Libraries and IDE&quot; style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Arduino Libraries and IDE&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;!--Write Arduino Library and IDE information below--&gt;      &lt;P&gt; Before you start to hook up any components, upload the following sketch to the Arduino microcontroller.          I am assuming that you already have the &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE&lt;/a&gt; installed on your computer.          If not, the IDE can be downloaded from &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;here&lt;/a&gt;.      &lt;/P&gt;    &lt;P&gt;           The &lt;a href=&quot;http://fastled.io/&quot;&gt;FastLED library&lt;/a&gt; is useful for simplifying the code for programming the RGB LED pixels.          The latest &quot;FastLED library&quot; can be downloaded from &lt;a href=&quot;https://github.com/FastLED/FastLED/releases&quot;&gt;here&lt;/a&gt;.          I used FastLED library version &lt;a href=&quot;https://github.com/FastLED/FastLED/tree/3.0.3&quot;&gt;3.0.3&lt;/a&gt; in this project.     &lt;/P&gt;    &lt;P&gt;        If you have a different LED strip or your RGB LED pixels have a different chipset, make sure to change the relevant lines of code          to accomodate your hardware. I would suggest you try out a few of the &lt;a href=&quot;https://github.com/FastLED/FastLED/tree/3.0.3/examples&quot;&gt;        FastLED library examples&lt;/a&gt; before using the code below,          so that you become more familiar with the library, and will be better equipped to make the necessary changes.      &lt;/P&gt;    &lt;P&gt;             If you have a single strand of 25 RGB LED pixels with the WS8201 chipset, then you will not have to make any modification below.     &lt;/P&gt; &lt;/P&gt;&lt;/div&gt; &lt;br&gt; &amp;nbsp;  &lt;br&gt;&lt;div id=&quot;Arduino Code&quot; style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;!--Paste GitHub Embed code below--&gt;      &lt;script src=&quot;https://gist.github.com/ArduinoBasics/0d7f61cf711180d9e7f4b112bbece698.js&quot;&gt;&lt;/script&gt;  &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Arduino Code Description&quot; style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;!--Write your comments about the code below--&gt;      &lt;h4&gt;Arduino Code Description&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;      The code above will generate a randomised raindrop pattern on the Arduino LED Light box, however I have written code for a few more LED animations. These animations were written specifically for this light-box setup.     In other words, once you have hooked everything up, you will be able to upload these other LED animations to the     Arduino board without any further modification to the hardware/wiring, and yet experience a totally different light effect. You can find the code for the other animation effects by clicking on the links below: &lt;br&gt;    &lt;/P&gt;  &lt;P&gt;    &lt;ol&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Breathing effect&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Ripple effect&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Clock effect&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Rotation effect&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Sweep effect&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Spiral effect&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Lightning effect&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;https://github.com/ArduinoBasics/LED-Light-Box/tree/master/Examples&quot;&gt;Paparazzi in the Rain effect&lt;/a&gt;&lt;/li&gt;    &lt;/ol&gt;  &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Hooking it up&quot; style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Hooking it up:&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;P&gt;      &lt;h3 style=&quot;color:#62AEB2&quot;&gt;Power requirements&lt;/h3&gt;    &lt;/P&gt;      &lt;P&gt;        Each LED pixel can draw up to 60 milliamps at maximum brightness (white). ie. 20 mA for each colour (red, green and blue). Therefore you should not try to power the LED strand       directly from the Arduino, because the strand will draw too much current and damage the microcontroller(and possibly your USB port too).        The LED strand will therefore need to be powered by a separate power supply. The power supply must       supply the correct voltage (5V DC) and must also be able to supply sufficient current (1.5A or greater per strand of 25 LEDs).        &lt;/P&gt;      &lt;P&gt;Excessive voltage will damage or destroy       your LED pixel strand. The LEDs will only draw as much current as they need, however your power supply must provide at least 1.5A or greater for each strand. If you chain two strands together,       you will need a 5V 3A power supply.     &lt;/P&gt;    &lt;P&gt;      &lt;h3 style=&quot;color:#62AEB2&quot;&gt;RGB LED pixel strand connection&lt;/h3&gt;       &lt;/P&gt;    &lt;P&gt;      There are 25 LED pixels per strand. Four of the wires at each end of the strand are terminated with a JST connector. The red wire is for power (VCC),  blue wire for ground (GND), yellow wire is for Data, and green wire for Clock.       A spare red wire (VCC) and a spare blue wire (GND) are attached to the ends of each strand for convenience, however, I did not use either. Please double check the colour of your wires... they may be different.      &lt;/P&gt;      &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjdmqBmVZzp2hUkCB9FL62783nlgUhLcY2Tllz_5ai9cQ0b9MNlJ59d-yV2G6CKUbCPW04jQ-j-AeI2GpH4_vMJoC_YwUT_0xvYbOYnnCuymB5yoPHXFOLIrQY8VNyV_o5YGcBUf2F5Sc/s1600/NeoPixel+Top2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;          &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;352&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjdmqBmVZzp2hUkCB9FL62783nlgUhLcY2Tllz_5ai9cQ0b9MNlJ59d-yV2G6CKUbCPW04jQ-j-AeI2GpH4_vMJoC_YwUT_0xvYbOYnnCuymB5yoPHXFOLIrQY8VNyV_o5YGcBUf2F5Sc/s640/NeoPixel+Top2.jpg&quot; width=&quot;640&quot;&gt;        &lt;/a&gt;    &lt;/div&gt;    &lt;/P&gt;    &lt;P&gt;      If you want to attach the LED strand to a breadboard, you can cut the JST connector off and use the LED pixel strand wires. Alternatively,       if you would prefer to preserve the JST connector, you can simply insert jumper wires (or some male header pins) into the JST connector, and then plug them into       the breadboard as required. &lt;/P&gt;      &lt;/P&gt;    &lt;P&gt;      Each LED pixel is individually controllable using two pins on your Arduino. The strand is directional. i.e. There is an INPUT side and an OUTPUT side.       The strand should be connected such that wires from the microcontroller are attached to the INPUT side of the first LED pixel. The arrows on each LED show the direction of data flow from INPUT to OUTPUT.        The arrow on the first LED pixel should be pointing towards the second LED pixel, NOT towards the breadboard.          &lt;/P&gt;       &lt;P&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;          &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSm5yAzaa8TrTI2scQbJt8q_aInO926Jd4WaqQeT3qW7dZVfml1MQZ-i1cA7II41L7p_PaXOVWoGm-eZamJY0-K-EXY1Pc_wfp3bnaeOIZA4-cKgfoAYy4QohiBPOpVIgJZt4hc1-ZM1w/s1600/NeoPixel+Side+Arrow+Plain2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;            &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSm5yAzaa8TrTI2scQbJt8q_aInO926Jd4WaqQeT3qW7dZVfml1MQZ-i1cA7II41L7p_PaXOVWoGm-eZamJY0-K-EXY1Pc_wfp3bnaeOIZA4-cKgfoAYy4QohiBPOpVIgJZt4hc1-ZM1w/s640/NeoPixel+Side+Arrow+Plain2.jpg&quot; width=&quot;640&quot; onmouseover=&quot;this.src=&amp;#39;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLaHfaawTLndQL97cMCV1McVIxhlIBO9H546DNCudDH_SOQCIrR0HJWE4mDTlfYU0QeiyN2a_6qX6KDOfoEGmBCOLK0OR7w1Gp8tnkp4ROCZp9N8ESEzwh-lEd0aHxR3zi3TZ17bUZA14/s640/NeoPixel+Side+Arrow+Plain2_Magnified2.jpg&amp;#39;&quot; onmouseout=&quot;this.src=&amp;#39;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSm5yAzaa8TrTI2scQbJt8q_aInO926Jd4WaqQeT3qW7dZVfml1MQZ-i1cA7II41L7p_PaXOVWoGm-eZamJY0-K-EXY1Pc_wfp3bnaeOIZA4-cKgfoAYy4QohiBPOpVIgJZt4hc1-ZM1w/s640/NeoPixel+Side+Arrow+Plain2.jpg&amp;#39;&quot;&gt;          &lt;/a&gt;        &lt;/div&gt;       &lt;/P&gt;        &lt;P&gt;      &lt;h3 style=&quot;color:#62AEB2&quot;&gt;Other considerations&lt;/h3&gt;     &lt;/P&gt;     &lt;P&gt;        As a precaution, you should use a large capacitor across the + and - terminals of the power supply to prevent the initial onrush of current from damaging the RGB LED pixels.          I used a 4700uF 16V Electrolytic capacitor for this purpose. According to Adafruit, a 1000uF 6.3V capacitor (or higher) will also do the trick. You may also want to consider a 330 ohm resistor between the Arduino Digital pin and the strand&#39;s DATA pin.      &lt;/P&gt;        &lt;P&gt;If you want to power the Arduino using the regulated 5V external power supply. Disconnect the USB cable from the Arduino, and then connect the positive terminal of the power supply to the 5V pin on the      Arduino. Be warned however, that excess voltage at this pin could damage your Arduino, because the 5V regulator will be bypassed. &lt;br&gt; &amp;nbsp;      &lt;br&gt;       Providing the USB cable is NOT connected to the Arduino, it should now be safe to plug the power supply into the wall.      This setup will allow you to power the RGB LED pixel strand and the Arduino using the same power supply. &lt;BR&gt; &amp;nbsp;      &lt;br&gt;     WARNING: Never change any connections while the circuit is powered.   &lt;br&gt;     &lt;br&gt;     For more information about these RGB LED pixel strands, you may want to visit the &lt;a href=&quot;https://learn.adafruit.com/12mm-led-pixels/&quot;&gt;Adafruit site&lt;/a&gt;.      Adafruit was the source for most of these RGB LED pixel Strand precautions.      &lt;/P&gt;  &lt;P&gt;        &lt;br&gt;    &lt;h4&gt;Fritzing diagram&lt;/h4&gt;  &lt;/P&gt;     &lt;P&gt;The following diagram demonstrates how to connect the RGB LED pixel Strand to the Arduino and to the External 5V power supply.&lt;/P&gt;  &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOKR764ojZOSCVoVhxSeneuLcmvVukazciS74UN_oFA-iukOQ7BQ3c5TcpX9tgP-Yayfg6NLTW8CxJ3WZ7lhb2ZZ88v8M0tktMq0CNmBb4fxD4mfFAk24AuDZoOmre7cwlxYOc4tKom7E/s1600/Fritzing_LightBox_3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;        &lt;img style=&quot;border:2px solid #8C7E6F;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOKR764ojZOSCVoVhxSeneuLcmvVukazciS74UN_oFA-iukOQ7BQ3c5TcpX9tgP-Yayfg6NLTW8CxJ3WZ7lhb2ZZ88v8M0tktMq0CNmBb4fxD4mfFAk24AuDZoOmre7cwlxYOc4tKom7E/s640/Fritzing_LightBox_3.jpg&quot;&gt;      &lt;/a&gt;    &lt;/div&gt;&lt;br /&gt;&lt;P&gt;  This diagram was created using &lt;a href=&quot;http://fritzing.org/&quot;&gt;Fritzing&lt;/a&gt;&lt;/P&gt;  &lt;/P&gt; &lt;br&gt;  &lt;P&gt;    &lt;h4&gt;Connection Instructions&lt;/h4&gt;  &lt;/P&gt;    These instructions will help to guide you through the process of connecting your RGB LED pixel strand to the Arduino, and to the external power supply.      The instructions assume that you will be powering the Arduino via a USB cable.   &lt;P&gt;  &lt;/P&gt;  &lt;P&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhITbtjgF5Qnv1C3fWJyeDWwqo2rCrN-WscpNcHwluhMAt_IjTCuX9YHX83TyIAgv2WF25J6p7Ib_SSoP5W61oGearpQE5AfzfoUv_WMNPLPQOusOioj4L5N8H8xrnt2qzdQud73n9j3Ig/s1600/Connection+Instructions.png&quot; imageanchor=&quot;1&quot; &gt;        &lt;img style=&quot;border:2px solid #8C7E6F;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhITbtjgF5Qnv1C3fWJyeDWwqo2rCrN-WscpNcHwluhMAt_IjTCuX9YHX83TyIAgv2WF25J6p7Ib_SSoP5W61oGearpQE5AfzfoUv_WMNPLPQOusOioj4L5N8H8xrnt2qzdQud73n9j3Ig/s640/Connection+Instructions.png&quot;&gt;      &lt;/a&gt;      &lt;/div&gt;  &lt;br&gt;  &lt;/P&gt;  &lt;br&gt;  &lt;P&gt;    &lt;h4&gt;LightBox assembly&lt;/h4&gt;  &lt;/P&gt;    &lt;P&gt; You will need to drill a 12mm hole into the craft timber box for each LED on the strand.   It is worth taking the time to make accurate measurements before drilling the holes. &lt;br&gt; &amp;nbsp;      &lt;br&gt;     I made 12 holes for the outside circle pattern (12cm diameter), 6 holes for the inside circle pattern (8cm diameter), and a      hole in the centre. I also made two holes at the front of the box, two on the left side, and two on the right side.      I made one last hole at the back of the box for the 2.1mm DC power line socket. &lt;br&gt; &amp;nbsp;      &lt;br&gt;       Therefore you should have a total of 26 holes in the box. 25 of the holes are for the RGB LED pixel LEDs and one for the external power supply      socket. &lt;br&gt;        &lt;/P&gt;     &lt;P&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfVWDjHHt9PZoq7eVey8_CtYqzQLZxW5tJSJLl-GVKVhtk_DZjGTJzAESS5jhS2SYeeLFhyphenhyphenRNrMPQ5Z9fwsWDFoZ23CuGjLmzdPOwFTsvDDtTXrXMN_DUDuzl6FPMZf0phuw7svh6eXhg/s1600/Drill+LightBox+Without+Numbers+Lid+Closed.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;          &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfVWDjHHt9PZoq7eVey8_CtYqzQLZxW5tJSJLl-GVKVhtk_DZjGTJzAESS5jhS2SYeeLFhyphenhyphenRNrMPQ5Z9fwsWDFoZ23CuGjLmzdPOwFTsvDDtTXrXMN_DUDuzl6FPMZf0phuw7svh6eXhg/s320/Drill+LightBox+Without+Numbers+Lid+Closed.jpg&quot; width=&quot;640&quot; onmouseover=&quot;this.src=&amp;#39;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB1UgR9pDPvC4G12HxDL1VWYRCcOU5em2JbFlsSC-3k4O4tI3BenKruR2RMKA7-lYBUgo9ByjsXK6QL259TEcawnzvnb0XwcOhhgY1VRCsj-iidPJ0V-JYPYnD2hBQx1acAYuDLaa4Lig/s320/Drill+LightBox+With+Numbers+Lid+Closed.jpg&amp;#39;&quot; onmouseout=&quot;this.src=&amp;#39;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfVWDjHHt9PZoq7eVey8_CtYqzQLZxW5tJSJLl-GVKVhtk_DZjGTJzAESS5jhS2SYeeLFhyphenhyphenRNrMPQ5Z9fwsWDFoZ23CuGjLmzdPOwFTsvDDtTXrXMN_DUDuzl6FPMZf0phuw7svh6eXhg/s320/Drill+LightBox+Without+Numbers+Lid+Closed.jpg&amp;#39;&quot;&gt;        &lt;/a&gt;     &lt;/div&gt;        &lt;/P&gt;     &lt;P&gt;     The lid of the box is about 19.5cm x 14.5cm long, which makes for a very tight squeeze. Probably too tight, because      you have to account for the inner dimensions of the box. The inside of the box is used to house the Arduino, breadboard, the chipset side of the LEDs and cables/components.      The inner dimensions of the box are 18cm x 13cm. Therefore, the housing for the LED chipset PCB (1.8cm x 2.5cm) prevented the box from closing.      I used a Dremel to carve out the space required to close the lid.      &lt;/P&gt;     &lt;P&gt;     &lt;/P&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj06kNzoNreYUYXL_J37Bpp8C_HB5W7C93rce2Jpg8deZEY6IArr2lxHTW70CXMl9J3muS5z-OYhYGb6hFOL3PQqKNBIZuzDDbe5uGkGRJ5hwwJAp3Na5OiMwMpfpN4jexbVhUFFRGLcGc/s1600/Drill+LightBox+Without+Numbers.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;        &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj06kNzoNreYUYXL_J37Bpp8C_HB5W7C93rce2Jpg8deZEY6IArr2lxHTW70CXMl9J3muS5z-OYhYGb6hFOL3PQqKNBIZuzDDbe5uGkGRJ5hwwJAp3Na5OiMwMpfpN4jexbVhUFFRGLcGc/s320/Drill+LightBox+Without+Numbers.jpg&quot; width=&quot;640&quot; onmouseover=&quot;this.src=&amp;#39;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEj6WuKDRl3i8ZwdeeokZkn1eCHvIBW2efsvtEV4QW1B3PntlX6GZ8R047HdRw-GVy2ho3kMKjCPj7_yJSqZS2cno_SHpzAfPMDenXJQOir7TKeOEbxkbKIySBPgqjhdC5mu1DuojGA1o/s320/Drill+LightBox+With+Numbers2.jpg&amp;#39;&quot; onmouseout=&quot;this.src=&amp;#39;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj06kNzoNreYUYXL_J37Bpp8C_HB5W7C93rce2Jpg8deZEY6IArr2lxHTW70CXMl9J3muS5z-OYhYGb6hFOL3PQqKNBIZuzDDbe5uGkGRJ5hwwJAp3Na5OiMwMpfpN4jexbVhUFFRGLcGc/s320/Drill+LightBox+Without+Numbers.jpg&amp;#39;&quot;&gt;      &lt;/a&gt;     &lt;/div&gt;     &lt;P&gt;Each LED is approximately 8cm apart on the strand, however, if you are really keen, you could cut the wires and extend them to any distance you require. But keep in mind     that each LED is mounted on a small PCB (with a WS2801 chipset).You will therefore need to leave a minimum of 2cm between each 12mm hole to accomodate the size of the PCB+LED.     If you plan carefully, you can probably squeeze a couple of LEDs within a distance of 1cm... but I would recommend that you give yourself     a bit more room, because the PCBs are not square, and there is a good chance that you will have to start all over again.&lt;/P&gt;      &lt;P&gt;       &lt;P&gt;     In hindsight, I could have made the circle patterns a bit smaller, however I don&#39;t know if I could have packed these LEDs any closer.      The diameter of the inner circle pattern must be at least 2cm smaller than the outer circle pattern. So I think &quot;a bigger box&quot; would have been the best option.       &lt;/P&gt;           Once all of the holes have been drilled, paint and decorate the box to suit your style.       &lt;/P&gt;    &lt;P&gt;    When the paint is dry, insert the LEDs into the drilled holes in number order. &lt;br&gt;    You can see the end result below.    &lt;/P&gt;     &lt;P&gt;  &lt;!-- Picture of the underside of the lid (showing how tight the LEDs are packed together) --&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8yBldbHIUPIrLLXxPe5GUmncT8nZMO6OAk0__Ecf0aa8JGeZIlf3DSZTIYav6_2v3aw5MCFuZfOIC-JlvUmYnc4-VJELAhF4RqVehL6r-KxcXB1lM8HKgpHpEeqSMxJ98bL0LOEbpkVg/s1600/Lid+Underside.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;      &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8yBldbHIUPIrLLXxPe5GUmncT8nZMO6OAk0__Ecf0aa8JGeZIlf3DSZTIYav6_2v3aw5MCFuZfOIC-JlvUmYnc4-VJELAhF4RqVehL6r-KxcXB1lM8HKgpHpEeqSMxJ98bL0LOEbpkVg/s640/Lid+Underside.JPG&quot; width=&quot;640&quot;&gt;    &lt;/a&gt;  &lt;/div&gt;&lt;br /&gt;  &lt;/P&gt;  &lt;br&gt;    &lt;P&gt;&lt;h4&gt;Project Pictures&lt;/h4&gt;  &lt;/P&gt;    &lt;P&gt;These pictures show the Light box after it has been drilled and painted. The LEDs have been inserted into their respective holes, and all      wires + Arduino + breadboard are hidden within the box.         &lt;/P&gt;  &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-t2MjIkj-ycb0yL_ZwVMaTX1tRaZQKqD24hmecYP3vKYtBnI_9fmQug0UKw2MUbyc4lRVqdSb6p9CaoDqZ9yedd8Krw8JR6n_x6nH1nc7zsFDZMaDDe3mhPCkKiMev7uMgGShhyphenhyphenQWWJE/s1600/LightBox_Day1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;        &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;424&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-t2MjIkj-ycb0yL_ZwVMaTX1tRaZQKqD24hmecYP3vKYtBnI_9fmQug0UKw2MUbyc4lRVqdSb6p9CaoDqZ9yedd8Krw8JR6n_x6nH1nc7zsFDZMaDDe3mhPCkKiMev7uMgGShhyphenhyphenQWWJE/s640/LightBox_Day1.jpg&quot; width=&quot;640&quot;&gt;      &lt;/a&gt;    &lt;/div&gt;&lt;br /&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOgJ4aP95Ji2y0MNTlaVKr2B4rGYfxZCnci_HG0tiU4gZQqjO5d_bXidVDfewrTt2rcIv6jGhS1pIX5vuqCGJATonjr0LG0xBoiE5QHR7AZsuJUotUsReiRkKHwdN6gqPYe1_qsYPYAnM/s1600/LightBox_Day2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;      &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;408&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOgJ4aP95Ji2y0MNTlaVKr2B4rGYfxZCnci_HG0tiU4gZQqjO5d_bXidVDfewrTt2rcIv6jGhS1pIX5vuqCGJATonjr0LG0xBoiE5QHR7AZsuJUotUsReiRkKHwdN6gqPYe1_qsYPYAnM/s640/LightBox_Day2.jpg&quot; width=&quot;640&quot;&gt;    &lt;/a&gt;  &lt;/div&gt;&lt;br /&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy9Jhwtl-vvN4vBpWD8TmhgLMXe8X9ZpGg70tiB6YGJuvJrjYK19O-6T0Er_q9ScYe5fNrjPO5f21zFhfvzrlsAb4eHJ2XeV4R9k6k4K7DCWaW3-D5YElq0AFFxhIpezgFND2GBLpjww4/s1600/LightBox+lit+up.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;      &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy9Jhwtl-vvN4vBpWD8TmhgLMXe8X9ZpGg70tiB6YGJuvJrjYK19O-6T0Er_q9ScYe5fNrjPO5f21zFhfvzrlsAb4eHJ2XeV4R9k6k4K7DCWaW3-D5YElq0AFFxhIpezgFND2GBLpjww4/s640/LightBox+lit+up.JPG&quot; width=&quot;640&quot;&gt;    &lt;/a&gt;  &lt;/div&gt;   &lt;br /&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw-ekDXOFXuVx_NJ5ZVx5cLHiLDYQgKtd0XX57xhenGZLXkngNN2vK7ZGu76xtTxrBrvzhnaH11QfF8PPGq7-csAIaYb0aHb0lJtrFv1hlO8rBHJC9VrqNvr9-WolBjmwBQcRFI6k94FY/s1600/LightBox+lit+up2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;      &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;450&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw-ekDXOFXuVx_NJ5ZVx5cLHiLDYQgKtd0XX57xhenGZLXkngNN2vK7ZGu76xtTxrBrvzhnaH11QfF8PPGq7-csAIaYb0aHb0lJtrFv1hlO8rBHJC9VrqNvr9-WolBjmwBQcRFI6k94FY/s640/LightBox+lit+up2.JPG&quot; width=&quot;640&quot;&gt;    &lt;/a&gt;  &lt;/div&gt;&lt;br /&gt;       &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Concluding comments&quot; style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;h4&gt;Concluding comments&lt;/h4&gt;  &lt;/P&gt;  &lt;P&gt;    &lt;!--Write concluding comments below--&gt;    Once you start writing LED animations for the RGB LED pixel Lightbox, it is very hard to stop. The colour combinations    &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Separator&quot;&gt;  &lt;P&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Social Engagement&quot; align=&quot;center&quot;&gt;  &lt;P&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;    &lt;/P&gt;&lt;/div&gt;  &lt;div id=&quot;ArduinoBasics Project Page Link&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;  &lt;P&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot;&gt;&lt;/a&gt;  &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;OpenLab Link&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;  &lt;P&gt;    This project would not have been possible without &lt;a href=&quot;http://openlab.com.au/&quot;&gt;OpenLab&#39;s&lt;/a&gt; collaborative effort.&lt;br&gt;    Please visit their site for more cool projects.          &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Separator2&quot;&gt;  &lt;P&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt;&lt;/div&gt; &lt;div id=&quot;Final social hint&quot;&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/543877878191040856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/10/arduino-led-light-box.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/543877878191040856'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/543877878191040856'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/10/arduino-led-light-box.html' title='Arduino LED Light Box'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/c2Q7lFYFGFY/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-1169861430386225015</id><published>2015-08-04T22:51:00.000+07:00</published><updated>2018-03-28T22:35:14.551+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="arduino code example"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="control"/><category scheme="http://www.blogger.com/atom/ns#" term="DTMF"/><category scheme="http://www.blogger.com/atom/ns#" term="Dual Tone Multi Frequency"/><category scheme="http://www.blogger.com/atom/ns#" term="Fun"/><category scheme="http://www.blogger.com/atom/ns#" term="Home Automation"/><category scheme="http://www.blogger.com/atom/ns#" term="IC Station"/><category scheme="http://www.blogger.com/atom/ns#" term="module"/><category scheme="http://www.blogger.com/atom/ns#" term="MT8870"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Servo"/><title type='text'>MT8870 DTMF - Dual Tone Multi Frequency Decoder</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;  &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;iframe width=&quot;640&quot; height=&quot;420&quot; src=&quot;https://www.youtube.com/embed/QIWRuIFFkD8?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;    &lt;/div&gt;  &lt;/P&gt;  &lt;div align=&quot;right&quot;&gt;      &lt;g:plusone&gt;&lt;/g:plusone&gt;  &lt;/div&gt;  &lt;P&gt;    &lt;h4&gt;Project Description&lt;/h4&gt;    We will be using an MT8870 DTMF module with an Arduino UNO to control a small servo motor in this project.     The DTMF module gives the Arduino super-powers and allows you to control the Servo motor in so many ways.     For example, this tutorial will show you how to control the servo motor using:     &lt;ul&gt;      &lt;li&gt;a YouTube Video&lt;/li&gt;      &lt;li&gt;a voice recorder&lt;/li&gt;      &lt;li&gt;A web application (Online tone generator)&lt;/li&gt;      &lt;li&gt;A smart phone app (DTMF Pad)&lt;/li&gt;      &lt;li&gt;A touch-tone phone to cell-phone call&lt;/li&gt;    &lt;/ul&gt;     All of these control methods will take advantage of the same exact Arduino code/sketch. But how???&lt;br&gt;    The MT8870 DTMF decoder is quite a neat little module that allows you incorporate DTMF technology into your arduino projects.     DTMF stands for &lt;b&gt;D&lt;/b&gt;ual-&lt;b&gt;T&lt;/b&gt;one &lt;b&gt;M&lt;/b&gt;ulti-&lt;b&gt;F&lt;/b&gt;requency. DTMF tones are commonly associated with touch-tone phones and other telecommunication systems.     When you press the number &quot;1&quot; on a touch-tone phone,  two sine waves with frequencies: 697Hz and 1209Hz are combined to produce a unique DTMF signal which can be transmitted through the phone line.     The MT8870 DTMF module can take this signal as an input, and decode it to produce a binary output.&lt;br&gt;&amp;nbsp;       &lt;br clear=&quot;all&quot;&gt;  &amp;nbsp;       &lt;br&gt;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm8J1OrBc5R1U2boGiV7tOn7T4mQzd_oqEWg65o2lGa-ESm8Zpj8GJsW_faWbZwriQY4AyrLq9vQoHVXqyWa270e8bw0rzE2lbqzfDwprPOdp0T9f-g4h0uKyW8WM3an2Sd1wmq1GqkTQ/s1600/DTMF+Frequency+Table.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;          &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm8J1OrBc5R1U2boGiV7tOn7T4mQzd_oqEWg65o2lGa-ESm8Zpj8GJsW_faWbZwriQY4AyrLq9vQoHVXqyWa270e8bw0rzE2lbqzfDwprPOdp0T9f-g4h0uKyW8WM3an2Sd1wmq1GqkTQ/s1600/DTMF+Frequency+Table.jpg&quot; /&gt;        &lt;/a&gt;      &lt;/div&gt;      &lt;br clear=&quot;all&quot;&gt;  &amp;nbsp;       &lt;br&gt;    The DTMF module does not care how you produce the DTMF tone. However, if it receives this tone, it will decode it. We can take advantage     of this feature to supply the module with tones from different sources. The module has a 3.5mm port for line input.     Providing you can connect your DTMF source to this line input in some way, it should work. I must warn you, however that     this is a line input and NOT a microphone input. If you wanted to use a microphone, you will need to boost or amplify the signal before sending it to the DTMF module.&lt;br&gt; &amp;nbsp;     &lt;br&gt;    You will need the following parts for this project&lt;br&gt;&amp;nbsp;     &lt;br&gt;  &lt;/P&gt;  &lt;P&gt;  &lt;h4&gt;Parts Required:&lt;/h4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=3746&quot; target=&quot;_blank&quot;&gt;Arduino Uno or compatible board&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=5259&quot; target=&quot;_blank&quot;&gt;ICStation MT8870 DTMF decoding module&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=3193&quot; target=&quot;_blank&quot;&gt;Jumper Cable (Male to Female)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=1603&quot; target=&quot;_blank&quot;&gt;Hobby Servo Motor&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;A cable to connect DTMF source with MT8870 DTMF Module&#39;s 3.5mm port&lt;/li&gt;        &lt;li&gt;A voice recorder (optional)&lt;/li&gt;        &lt;li&gt;2 x touch-tone phones / smart phones (optional)&lt;/li&gt;    &lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt;  &lt;P&gt;  &lt;h4&gt;Software/Apps Required&lt;/h4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;&lt;a href=&quot;https://www.arduino.cc/en/main/software&quot;&gt;Arduino IDE&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;https://itunes.apple.com/gb/app/dtmf-pad/id312536578?mt=8&quot;&gt;DTMF Pad by IEIRISOFTWARE LAB. (for iOS devices)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.amknott.ToneGen&quot;&gt;DTMF Tone Generator by Andrew M. Knott (for android devices)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://onlinetonegenerator.com/dtmf.html&quot;&gt;Online Tone Generator&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=fpDa7a42SJE&quot;&gt;A YouTube video with DTMF tones&lt;/a&gt;&lt;/li&gt;    &lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt;  &lt;P&gt;  &lt;h4&gt;Arduino Sketch&lt;/h4&gt;&lt;br&gt;    Upload the following sketch to the Arduino.     &lt;br&gt; &amp;nbsp;     &lt;br&gt;    &lt;style type=&quot;text/css&quot;&gt;span {  } .sc0 { } .sc1 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #808080; } .sc2 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #808080; } .sc4 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #000000; } .sc5 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  font-weight: bold;  color: #D35400; } .sc9 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #000000; } .sc10 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  font-weight: bold;  color: #000040; } .sc11 { } .sc16 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #00979C; } &lt;/style&gt;&lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;    &lt;table&gt;     &lt;tr&gt;      &lt;td&gt;       &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt;&lt;span class=&quot;sc4&quot;&gt;&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;br /&gt;15&lt;br /&gt;16&lt;br /&gt;17&lt;br /&gt;18&lt;br /&gt;19&lt;br /&gt;20&lt;br /&gt;21&lt;br /&gt;22&lt;br /&gt;23&lt;br /&gt;24&lt;br /&gt;25&lt;br /&gt;26&lt;br /&gt;27&lt;br /&gt;28&lt;br /&gt;29&lt;br /&gt;30&lt;br /&gt;31&lt;br /&gt;32&lt;br /&gt;33&lt;br /&gt;34&lt;br /&gt;35&lt;br /&gt;36&lt;br /&gt;37&lt;br /&gt;38&lt;br /&gt;39&lt;br /&gt;40&lt;br /&gt;41&lt;br /&gt;42&lt;br /&gt;43&lt;br /&gt;44&lt;br /&gt;45&lt;br /&gt;46&lt;br /&gt;47&lt;br /&gt;48&lt;br /&gt;49&lt;br /&gt;50&lt;br /&gt;51&lt;br /&gt;52&lt;br /&gt;53&lt;br /&gt;54&lt;br /&gt;55&lt;br /&gt;56&lt;br /&gt;57&lt;br /&gt;58&lt;br /&gt;59&lt;br /&gt;60&lt;br /&gt;61&lt;br /&gt;62&lt;/span&gt;&lt;/pre&gt; &lt;/td&gt; &lt;td&gt;  &lt;div style=&quot;float: left; white-space: pre; line-height: 125%; background: #FFFFFF; &quot;&gt;&lt;span class=&quot;sc4&quot;&gt;&lt;span class=&quot;sc1&quot;&gt;/* ==================================================================================================================================================          Project: MT8870 DTMF Servo sketch           Author: Scott C          Created: 4th August 2015      Arduino IDE: 1.6.4          Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html      Description: This project will allow you to control a Servo motor using an Arduino UNO and a MT8870 DTMF Module.                   The DTMF signal is received through the 3.5mm port of the DTMF module and is decoded. We will use the                   decoded output to control the position of the Servo. A SG-5010 Servo motor was used in this project. ===================================================================================================================================================== */&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//This sketch uses the Servo library that comes with the Arduino IDE &lt;/span&gt;&lt;span class=&quot;sc9&quot;&gt;#include &amp;lt;Servo.h&amp;gt; &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Global variables----------------------------------------------------------------------------------------- &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;Servo&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;SG5010&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;             &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// The SG5010 variable provides Servo functionality &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;servoPosition&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// The servoPosition variable will be used to set the position of the servo &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// The DTMFread variable will be used to interpret the output of the DTMF module. &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;STQ&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// Attach DTMF Module STQ Pin to Arduino Digital Pin 3 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q4&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// Attach DTMF Module Q4  Pin to Arduino Digital Pin 4 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q3&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// Attach DTMF Module Q3  Pin to Arduino Digital Pin 5 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q2&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// Attach DTMF Module Q2  Pin to Arduino Digital Pin 6 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q1&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// Attach DTMF Module Q1  Pin to Arduino Digital Pin 7 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc1&quot;&gt;/*========================================================================================================= setup() : will setup the Servo, and prepare the Arduino to receive the MT8700 DTMF module&#39;s output. ========================================================================================================== */&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;SG5010&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;attach&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;             &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// The Servo signal cable will be attached to Arduino Digital Pin 9 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;SG5010&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;servoPosition&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// Set the servo position to zero. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Setup the INPUT pins on the Arduino &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;STQ&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q4&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q3&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q2&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q1&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc1&quot;&gt;/*========================================================================================================= loop() : Arduino will interpret the DTMF module output and position the Servo accordingly ========================================================================================================== */&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;STQ&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)==&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//When a DTMF tone is detected, STQ will read HIGH for the duration of the tone. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q1&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)==&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//If Q1 reads HIGH, then add 1 to the DTMFread variable &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q2&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)==&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//If Q2 reads HIGH, then add 2 to the DTMFread variable &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q3&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)==&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//If Q3 reads HIGH, then add 4 to the DTMFread variable &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;Q4&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)==&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//If Q4 reads HIGH, then add 8 to the DTMFread variable &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;servoPosition&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DTMFread&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;8.5&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Set the servoPosition varaible to the combined total of all the Q1 to Q4 readings. Multiply by 8.5 to amplify the servo rotation. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;SG5010&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;servoPosition&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Set the servo&#39;s position according to the &quot;servoPosition&quot; variable. &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;   &lt;/P&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;   &lt;br&gt; &amp;nbsp;   &lt;br&gt;  &lt;P&gt;    &lt;h4&gt;Fritzing Sketch&lt;/h4&gt;&lt;br&gt;    Connect the Arduino to the MT8870 DTMF module, and to a Servo.&lt;br&gt;    Use the following Fritzing sketch as a guide.&lt;br&gt; &amp;nbsp;     &lt;br&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0v6MJSL7ijpMZ_465kZaFbA7meG5Q3HAyoNiq8BJsegnZopT54fx6SZkbDTqUnEQ2BsPFXjJQc0xbTOFbZG5GgeEySS_liujj1ONCjJXl-6wclhn066OrdgtrDt23xXwaetCpQz9qPM8/s1600/DTMF+Fritzing+2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;        &lt;img style=&quot;border:3px double white;&quot; height=&quot;552&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0v6MJSL7ijpMZ_465kZaFbA7meG5Q3HAyoNiq8BJsegnZopT54fx6SZkbDTqUnEQ2BsPFXjJQc0xbTOFbZG5GgeEySS_liujj1ONCjJXl-6wclhn066OrdgtrDt23xXwaetCpQz9qPM8/s640/DTMF+Fritzing+2.jpg&quot; width=&quot;640&quot; /&gt;      &lt;/a&gt;    &lt;/div&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt; (Click the image above to enlarge it) &lt;/div&gt;  &lt;/P&gt;   &lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;br&gt;&lt;h4&gt;Discussion &lt;/h4&gt;&lt;br&gt;You will need to connect a cable from the DTMF module&#39;s 3.5mm port to that of your smart phone, computer, voice recorder or any other DTMF source of your choice.&lt;br&gt; &amp;nbsp; &lt;br&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;  &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipuD2NjhXIl2xa5bexJD9-sqDE8-SKG_jfAsVOfnMxLb_yFadjvEHWk-2qjfJVtQR82oXzdJLaCleQNB6I5dehpsn0HUmZ2neu8-1gsHMdJFdCEBEnyzOHfkqbm_DMdYaAwYq_4mjOHAY/s1600/3_5mm+jack.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;    &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipuD2NjhXIl2xa5bexJD9-sqDE8-SKG_jfAsVOfnMxLb_yFadjvEHWk-2qjfJVtQR82oXzdJLaCleQNB6I5dehpsn0HUmZ2neu8-1gsHMdJFdCEBEnyzOHfkqbm_DMdYaAwYq_4mjOHAY/s400/3_5mm+jack.jpg&quot; /&gt;  &lt;/a&gt;&lt;/div&gt; &lt;br&gt; &amp;nbsp; &lt;br&gt;&lt;P&gt;When you power up your Arduino, the Servo motor should turn all the way to the left to it&#39;s zero position.    Once the DTMF module receives a DTMF signal, it will identify the relevant frequecies as described in the table at the beginning of this tutorial,    and produce a binary like output. You will notice the DTMF module&#39;s onboard LEDs light up when a tone is detected.    Onboard LED (D5) will turn on for the length of the DTMF tone it just received, and turn off when the tone has stopped.  On the other hand, the onboard LEDs (D1 to D4) will light up depending on the tone received, and will remain lit until the module receives another tone.  The onboard LEDs are a visual representation of the voltages applied to the DTMF module&#39;s pins (Q1 to Q4, and STQ). Q1 matches D1, Q2 matches D2 etc etc. and STQ matches D5. &lt;br&gt;&amp;nbsp; &lt;br&gt;You will notice that there are two STQ pins on the DTMF module. The STQ pin that is closest to Q4 will only go high when a DTMF tone is detected, and will remain high for the duration of the tone. The other STQ pin is the exact opposite. It will switch LOW when a tone is received and remain LOW for the duration of the tone. When there is no tone, this STQ pin will remain HIGH.  The table below provides a summary of the DTMF module outputs, with a blue box representing a voltage applied to that pin (HIGH), whereas a black box indicates no voltage applied (LOW).&lt;br&gt; &lt;/P&gt;&lt;P&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJF0X2cyOdJNayQHi_4Ki9MMOFB4xTxyLfDoZa_Q2OS790S_o1R8KS1Sv_Fs0xlk-HJCsFWYM7XlgxrjpJiYZZadGo_CTRIScQ-av7GTABEMkNu0_SkK-Q2FR7slghiUGScguhDfBo9J4/s1600/DTMF+Module+Output.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;      &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJF0X2cyOdJNayQHi_4Ki9MMOFB4xTxyLfDoZa_Q2OS790S_o1R8KS1Sv_Fs0xlk-HJCsFWYM7XlgxrjpJiYZZadGo_CTRIScQ-av7GTABEMkNu0_SkK-Q2FR7slghiUGScguhDfBo9J4/s1600/DTMF+Module+Output.jpg&quot; /&gt;    &lt;/a&gt;  &lt;/div&gt;&lt;/P&gt;&lt;br&gt; &amp;nbsp; &lt;br&gt;In order to follow this project, you need a source of DTMF tones. You can produce DTMF tones using a touch-tone phone, or through the use of a DTMF Pad app. If you are feeling creative, you can create a DTMF song/tune like the one I posted on YouTube. You can see the video below:&lt;br&gt; &amp;nbsp; &lt;br&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;  &lt;iframe width=&quot;640&quot; height=&quot;420&quot; src=&quot;https://www.youtube.com/embed/fpDa7a42SJE?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br&gt; &amp;nbsp; &lt;br&gt;As you can see from the video, I also recorded the DTMF tune onto a voice recorder, and was able to control the servo that way. If you are not feeling creative, you can visit &lt;a href=&quot;http://onlinetonegenerator.com/dtmf.html&quot;&gt;this website&lt;/a&gt; to create DTMF tones from your browser.   &lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt; &lt;P&gt;  &lt;h4&gt;Concluding comments&lt;/h4&gt;&lt;br&gt;  This project was very fun, and shows some novel ways to control your Arduino. After completing the project, I realised that I could   use this module to alert me when new emails or messages arrive on my phone or computer. If you have the ability to change the email or message notification sound to a DTMF tone, you should be able to get   the module and Arduino to respond accordingly. Oh well, maybe I&#39;ll save that project for another day. &lt;br&gt; &amp;nbsp;   &lt;br&gt;  If this project helped you in anyway or if you use my code within your project, please let me know in the comments below.   I would be interested to see what you did.  &lt;/P&gt; &lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;    If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;    &lt;BR /&gt;&amp;nbsp;     &lt;BR /&gt;    Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;    Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;    I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;    Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;br&gt;&amp;nbsp;   &lt;br&gt;&lt;div&gt;  &lt;P&gt;    &lt;!--separator --&gt;    &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;    &lt;br /&gt;  &lt;/P&gt;&lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit. &lt;/P&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/1169861430386225015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/08/mt8870-dtmf-dual-tone-multi-frequency.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/1169861430386225015'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/1169861430386225015'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/08/mt8870-dtmf-dual-tone-multi-frequency.html' title='MT8870 DTMF - Dual Tone Multi Frequency Decoder'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/QIWRuIFFkD8/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-365032789723354536</id><published>2015-07-18T01:11:00.000+07:00</published><updated>2018-03-28T22:35:14.651+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="Beginners"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="display"/><category scheme="http://www.blogger.com/atom/ns#" term="Ear-clip"/><category scheme="http://www.blogger.com/atom/ns#" term="FastLED"/><category scheme="http://www.blogger.com/atom/ns#" term="Heart"/><category scheme="http://www.blogger.com/atom/ns#" term="Heart Beat"/><category scheme="http://www.blogger.com/atom/ns#" term="Heart Rate"/><category scheme="http://www.blogger.com/atom/ns#" term="Learning"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Library"/><category scheme="http://www.blogger.com/atom/ns#" term="NeoPixels"/><category scheme="http://www.blogger.com/atom/ns#" term="power"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Sensor"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="UNO"/><title type='text'>NeoPixel Heart Beat Display</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;img style=&quot;border:3px double white;&quot; height=&quot;139&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWOHLusvd2Q18eg2pYmTIl8XNP8WW3PitYMXjq3E7XfSguUoR8ACQWnPijNxBne7htkhhTXGdEyImkv7zNMKO5Wjz72Btd0vtmqlPYI69Ehhs1O7EF887NVtil5yb6dvHhMYgCMKWLSQA/s400/Neopixel+Heart+Beat+Display+Title+image.jpg&quot; width=&quot;640&quot; /&gt;        &lt;/div&gt;&lt;br /&gt; &lt;/P&gt; &lt;P&gt;  &lt;div&gt;   &lt;P&gt;&lt;h4&gt;Project Description&lt;/h4&gt;    &lt;br&gt;     In this project, your heart will control a mesmerising LED sequence on a &lt;a href=&quot;http://openlab.com.au/shop/neopixel-digital-rgb-led-weatherproof-strip-60-led-1m/&quot;&gt;5 metre Neopixel LED strip with a ws2812B chipset&lt;/a&gt;. Every heart beat     will trigger a LED animation that will keep you captivated and attached to your Arduino for ages. The good     thing about this project is that it is relatively easy to set up, and requires no soldering. The hardest part is     downloading and installing the FastLED library into the Arduino IDE, but that in itself is not too difficult.     The inspiration and idea behind this project came from &lt;a href=&quot;http://be.net/alimurtaza&quot;&gt;Ali Murtaza&lt;/a&gt;, who wanted to know how to get an LED strip to pulse to his heart beat.     &lt;br&gt;&amp;nbsp     &lt;br&gt;    Have a look at the video below to see this project in action.     &lt;br&gt;&amp;nbsp;     &lt;br&gt;&amp;nbsp;     &lt;br&gt;&amp;nbsp;     &lt;br&gt;        &lt;H4&gt;The Video&lt;/H4&gt;        &lt;BR /&gt;&amp;nbsp;             &lt;div style=&quot;text-align: center;&quot;&gt;             &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/KEqQTcDHwEw?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;            &lt;/div&gt;   &lt;/P&gt;  &lt;/div&gt;  &lt;/P&gt; &lt;br&gt;&amp;nbsp;  &lt;br&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Parts Required:&lt;/H4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/arduino-uno-rev3/&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/neopixel-digital-rgb-led-weatherproof-strip-60-led-1m/&quot;&gt;NeoPixel Digital RGB LED Weatherproof Strip 30 LED/m  &lt;b&gt;(5m length)&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/658&quot;&gt;Adafruit 5V 10A switching power supply (PRODUCT ID: 658)&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/depot/Grove-Earclip-Heart-Rate-Sensor-p-1116.html?cPath=25_29&quot;&gt;Grove Ear-clip Heart Rate Sensor&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.seeedstudio.com/depot/Grove-Base-Shield-p-754.html&quot;&gt;Grove Base Shield&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/half-size-breadboard/&quot;&gt;Breadboard&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/breadboard-jumper-wire-set-140-pcs-pack/&quot;&gt;Breadboard jumper wire&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/resk-resistor-kit/&quot;&gt;330 ohm resitor&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Passive-Components/Capacitors/Electrolytic/4700uF-16V-RB-Electrolytic-Capacitor---105oC/p/RE6243&quot;&gt;4700uF 16V Electrolytic Capacitor (Jaycar Cat No. RE6243)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Interconnect/Terminals-%26-Headers/Pluggable-Terminal-Blocks/6-Pole-PC-Mount-Pluggable-Header---5-08mm---Horizontal/p/HM3106&quot;&gt;6 Pole PC Mount Pluggable Header (Jaycar Cat No. HM3106)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Interconnect/Terminals-%26-Headers/Pluggable-Terminal-Blocks/6-Pole-PC-Mount-Pluggable-Terminal-Block-Socket---5-08mm/p/HM3126&quot;&gt;6 Pole PC Mount Pluggable Terminal Block Socket (Jaycar Cat No. HM3126)&lt;/a&gt;&lt;/li&gt;                &lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt; &lt;br&gt;&amp;nbsp;  &lt;H4&gt;Power Requirements&lt;/H4&gt;    &lt;P&gt;        Before you start any LED strip project, the first thing you will need to think about is POWER. According to the &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide/power&quot;&gt;Adafruit website&lt;/a&gt;,         each individual NeoPixel LED can draw up to 60 milliamps at maximum brightness - white. Therefore the amount of current required for the entire strip will be way more than your Arduino can handle.         If you try to power this LED strip directly from your Arduino, you run the risk of damaging not only your Arduino, but your USB port as well. The Arduino will be used to control the LED strip,         but the LED strip will need to be powered by a separate power supply. The power supply you choose to use is important. It must provide the correct voltage, and must able to supply sufficient current.&lt;br&gt;  &amp;nbsp;         &lt;br&gt;           &lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;Operating Voltage (5V)&lt;/h3&gt;           The operating voltage of the NeoPixel strip is 5 volts DC.  Excessive voltage will damage/destroy your NeoPixels. &lt;br&gt;           &lt;br&gt;           &lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;Current requirements (9.0 Amps)&lt;/h3&gt;           OpenLab recommend the use of a 5V 10A power supply. Having more Amps is OK, providing the output voltage is 5V DC.            The LEDs will only draw as much current as they need. To calculate the amount of current this 5m strip can draw with all LEDs turned on at full brightness - white: &lt;br&gt;        &lt;br&gt;        &lt;span style=&quot;color: #7FD4FF; font-size: large;&quot;&gt;30 &lt;/span&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;NeoPixel LEDs&lt;/span&gt;  x &lt;span style=&quot;color: #7FD4FF; font-size: large;&quot;&gt;60&lt;/span&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;mA&lt;/span&gt; x &lt;span style=&quot;color: #7FD4FF; font-size: large;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;m&lt;/span&gt;  =  &lt;span style=&quot;color: #7FD4FF; font-size: large;&quot;&gt;9000&lt;/span&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;mA&lt;/span&gt; = &lt;span style=&quot;color: #7FD4FF; font-size: large;&quot;&gt;9.0 &lt;/span&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;Amps for a 5 metre strip.&lt;/span&gt;&lt;br&gt;        &lt;br&gt;        Therefore a 5V 10A power supply would be able to handle the maximum current (9.0 Amps) demanded by a 5m NeoPixel strip containing a total of 150 LEDs. &lt;br&gt;&amp;nbsp;         &lt;br&gt; &amp;nbsp    &lt;/P&gt;         &lt;br&gt; &lt;P&gt;  &lt;H4&gt;Arduino Libraries and IDE&lt;/H4&gt;  &lt;BR /&gt;  Before you start to hook up any components, upload the following sketch to the Arduino microcontroller.         I am assuming that you already have the &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE&lt;/a&gt; installed on your computer. If not, the IDE can be downloaded from &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;here&lt;/a&gt;. &lt;br&gt; &amp;nbsp;   &lt;br&gt;  The &lt;a href=&quot;http://fastled.io/&quot;&gt;FastLED library&lt;/a&gt; is useful for simplifying the code for programming the NeoPixels.   The latest &quot;FastLED library&quot; can be downloaded from &lt;a href=&quot;https://github.com/FastLED/FastLED/releases&quot;&gt;here&lt;/a&gt;. I used FastLED library version &lt;a href=&quot;https://github.com/FastLED/FastLED/tree/3.0.3&quot;&gt;3.0.3&lt;/a&gt; in this project.&lt;br&gt;   &amp;nbsp;   &lt;br&gt;  If you have a different LED strip or your NeoPixels have a different chipset, make sure to change the relevant lines of code to accomodate your hardware.   I would suggest you try out a few of the &lt;a href=&quot;https://github.com/FastLED/FastLED/tree/3.0.3/examples&quot;&gt;FastLED library examples&lt;/a&gt; before using the code below, so that you become more familiar with the library, and   will be better equipped to make the necessary changes. If you have a 5 metre length of the NeoPixel 30 LED/m strip with the ws2812B chipset, then you will not have to make   any modification below.&lt;br&gt; &amp;nbsp;   &lt;br&gt;  &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;&lt;br&gt;  &lt;style type=&quot;text/css&quot;&gt;span {  } .sc0 { } .sc1 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #808080; } .sc2 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #808080; } .sc4 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #000000; } .sc5 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  font-weight: bold;  color: #D35400; } .sc9 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #000000; } .sc10 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  font-weight: bold;  color: #000040; } .sc11 { } .sc16 {  font-family: &#39;Courier New&#39;;  font-size: 10pt;  color: #00979C; } &lt;/style&gt;&lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;    &lt;table&gt;     &lt;tr&gt;      &lt;td&gt;       &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt;&lt;span class=&quot;sc4&quot;&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;br /&gt;15&lt;br /&gt;16&lt;br /&gt;17&lt;br /&gt;18&lt;br /&gt;19&lt;br /&gt;20&lt;br /&gt;21&lt;br /&gt;22&lt;br /&gt;23&lt;br /&gt;24&lt;br /&gt;25&lt;br /&gt;26&lt;br /&gt;27&lt;br /&gt;28&lt;br /&gt;29&lt;br /&gt;30&lt;br /&gt;31&lt;br /&gt;32&lt;br /&gt;33&lt;br /&gt;34&lt;br /&gt;35&lt;br /&gt;36&lt;br /&gt;37&lt;br /&gt;38&lt;br /&gt;39&lt;br /&gt;40&lt;br /&gt;41&lt;br /&gt;42&lt;br /&gt;43&lt;br /&gt;44&lt;br /&gt;45&lt;br /&gt;46&lt;br /&gt;47&lt;br /&gt;48&lt;br /&gt;49&lt;br /&gt;50&lt;br /&gt;51&lt;br /&gt;52&lt;br /&gt;53&lt;br /&gt;54&lt;br /&gt;55&lt;br /&gt;56&lt;br /&gt;57&lt;br /&gt;58&lt;br /&gt;59&lt;br /&gt;60&lt;br /&gt;61&lt;br /&gt;62&lt;br /&gt;63&lt;br /&gt;64&lt;br /&gt;65&lt;br /&gt;66&lt;br /&gt;67&lt;br /&gt;68&lt;br /&gt;69&lt;br /&gt;70&lt;br /&gt;71&lt;br /&gt;72&lt;br /&gt;73&lt;br /&gt;74&lt;br /&gt;75&lt;br /&gt;76&lt;br /&gt;77&lt;br /&gt;78&lt;br /&gt;79&lt;br /&gt;80&lt;br /&gt;81&lt;br /&gt;82&lt;br /&gt;83&lt;br /&gt;84&lt;br /&gt;85&lt;br /&gt;86&lt;br /&gt;87&lt;br /&gt;88&lt;br /&gt;89&lt;br /&gt;90&lt;br /&gt;91&lt;br /&gt;92&lt;br /&gt;93&lt;br /&gt;94&lt;br /&gt;95&lt;br /&gt;96&lt;br /&gt;97&lt;br /&gt;98&lt;br /&gt;99&lt;br /&gt;100&lt;br /&gt;101&lt;br /&gt;102&lt;br /&gt;103&lt;br /&gt;104&lt;br /&gt;105&lt;br /&gt;106&lt;br /&gt;107&lt;br /&gt;108&lt;br /&gt;109&lt;br /&gt;110&lt;br /&gt;111&lt;br /&gt;112&lt;br /&gt;113&lt;br /&gt;114&lt;br /&gt;115&lt;br /&gt;116&lt;br /&gt;117&lt;br /&gt;118&lt;br /&gt;119&lt;br /&gt;120&lt;br /&gt;121&lt;br /&gt;122&lt;br /&gt;123&lt;br /&gt;124&lt;br /&gt;125&lt;br /&gt;126&lt;br /&gt;127&lt;br /&gt;128&lt;br /&gt;129&lt;br /&gt;130&lt;br /&gt;131&lt;br /&gt;132&lt;br /&gt;133&lt;br /&gt;134&lt;br /&gt;135&lt;br /&gt;136&lt;br /&gt;137&lt;br /&gt;138&lt;br /&gt;139&lt;br /&gt;140&lt;/span&gt;&lt;/pre&gt; &lt;/td&gt; &lt;td&gt;  &lt;div style=&quot;float: left; white-space: pre; line-height: 125%; background: #FFFFFF; &quot;&gt;&lt;span class=&quot;sc4&quot;&gt;&lt;span class=&quot;sc1&quot;&gt;/* ================================================================================================          Project: NeoPixel Heart Beat Display Neopixel chipset: ws2812B  (30 LED/m strip)           Author: Scott C          Created: 8th July 2015      Arduino IDE: 1.6.4          Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html      Description: This sketch will display a heart beat on a 5m Neopixel LED strip.                   Requires a Grove Ear-clip heart rate sensor and a Neopixel strip.                    This project makes use of the FastLED library: http://fastled.io/                   You may need to modify the code below to accomodate your specific LED strip.                   See the FastLED library site for more details. ================================================================================================== */&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//This project needs the FastLED library - link in the description. &lt;/span&gt;&lt;span class=&quot;sc9&quot;&gt;#include &quot;FastLED.h&quot; &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//The total number of LEDs being used is 150 &lt;/span&gt;&lt;span class=&quot;sc9&quot;&gt;#define NUM_LEDS 150 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;// The data pin for the NeoPixel strip is connected to digital Pin 6 on the Arduino &lt;/span&gt;&lt;span class=&quot;sc9&quot;&gt;#define DATA_PIN 6 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Attach the Grove Ear-clip heart rate sensor to digital pin 2 on the Arduino. &lt;/span&gt;&lt;span class=&quot;sc9&quot;&gt;#define EAR_CLIP 2 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Initialise the LED array &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;CRGB&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;NUM_LEDS&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Initialise the global variables used to control the LED animation &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;           &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Keep track of the LEDs &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;beated&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Used to identify when the heart has beated &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;randomR&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//randomR used to randomise the fade-out of the LEDs &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//================================================================================================ // setup() : Is used to initialise the LED strip //================================================================================================ &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;FastLED&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;addLeds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;NEOPIXEL&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;DATA_PIN&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;NUM_LEDS&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Set digital pin 2 (Ear-clip heart rate sensor) as an INPUT &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;EAR_CLIP&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//================================================================================================ // loop() : Take readings from the Ear-clip sensor, and display the animation on the LED strip //================================================================================================ &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//If the Ear-clip sensor moves from LOW to HIGH, call the beatTriggered method &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;EAR_CLIP&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)&amp;gt;&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//beatTriggered() is only called if the &#39;beated&#39; variable is false. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//This prevents multiple triggers from the same beat. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;beated&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;beatTriggered&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;beated&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Change the &#39;beated&#39; variable to false when the Ear-clip heart rate sensor is reading LOW. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Fade the LEDs by 1 unit/cycle, when the heart is at &#39;rest&#39; (i.e. between beats) &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;fadeLEDs&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//================================================================================================ // beatTriggered() : This is the LED animation sequence when the heart beats //================================================================================================ &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;beatTriggered&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Ignite 30 LEDs with a red value between 0 to 255 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;++){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//The red channel is randomised to a value between 0 to 255 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;random8&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;FastLED&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Call the fadeLEDs method after every 3rd LED is lit. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;fadeLEDs&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Move to the next LED &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;++;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Make sure to move back to the beginning if the animation falls off the end of the strip &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;NUM_LEDS&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Ignite 20 LEDS with a blue value between 0 to 120 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;++){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//The blue channel is randomised to a value between 0 to 120 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;random8&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;120&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;FastLED&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Call the fadeLEDs method after every 3rd LED is lit. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;fadeLEDs&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Move to the next LED &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;++;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Make sure to move back to the beginning if the animation falls off the end of the strip &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;NUM_LEDS&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;)){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;ledNum&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Change the &#39;beated&#39; variable to true, until the Ear-Clip sensor reads LOW. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;beated&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//================================================================================================ // fadeLEDs() : The fading effect of the LEDs when the Heart is resting (Ear-clip reads LOW) //================================================================================================ &lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;fadeLEDs&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;fadeVal&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc16&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;NUM_LEDS&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;++){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Fade every LED by the fadeVal amount &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;fadeToBlackBy&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;fadeVal&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Randomly re-fuel some of the LEDs that are currently lit (1% chance per cycle) &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//This enhances the twinkling effect. &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;randomR&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;random8&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;randomR&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Set the red channel to a value of 80 &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc2&quot;&gt;//Increase the green channel to 20 - to add to the effect &lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;leds&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;sc11&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sc4&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;FastLED&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;sc5&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;sc0&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sc10&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/div&gt; &lt;/P&gt;     &lt;br&gt; &amp;nbsp;     &lt;br&gt;  &lt;h4&gt;NeoPixel Strip connection &lt;/h4&gt;   &lt;P&gt;         The NeoPixel strip is rolled up when you first get it. You will notice that there are wires on both sides of the strip.        This allows you to chain LED strips together to make longer strips. The more LEDs you have, the more current you will need.          Connect your Arduino and power supply to the left side of the strip, with the arrows pointing to the right. (i.e. the side with the &quot;female&quot; jst connector).          &lt;br clear=&quot;all&quot;&gt;  &amp;nbsp;      &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;      &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc7uWmIQ2sdqaNVqcVlhuGlHHMKycz3PJRk6LwTbN9BhcIuymeuktPu9x_EaTYjhSnu-eYRBsz_U6o3XxLwc6gsIxNz2FOo9Bt1T8MfsX_KwmsuuR1ctfPYfonsA_HVJCT3S27f-W33GY/s1600/Neopixel+strip+left+side.jpg&quot; width=&quot;640&quot; /&gt;&lt;/div&gt;      &lt;br /&gt;         &lt;br&gt;      &lt;/P&gt;   &lt;P&gt;&lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;NeoPixel Strip Wires&lt;/h3&gt;    There are 5 wires that come pre-attached to either side of the LED strip. &lt;br&gt; &amp;nbsp;     &lt;br&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;     &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2-yBhMtKle1CgSwnTWPnAMGJRSOC42u1jDo-YcGQwlkjmATv9pByjzpSQ2bR-yG3JU1B2PQ1FN4cyeCiup2xfg9_ltqjZMhW9sn-f5OC17Ex1rUofvbkGHMVYyUyPTjtoBF2gMtBGs4I/s640/NeoPixel+Wires.jpg&quot; width=&quot;400&quot; /&gt;    &lt;/div&gt;&lt;br&gt;&amp;nbsp;     &lt;br&gt;    You don&#39;t have to use ALL FIVE wires, however you will need at least one of each colour: red, white &amp; green.&lt;br&gt;&amp;nbsp;     &lt;br&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;     &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGIRvxSQSHgxn5QExbK9JYGV5f7HkGedgzCin26ZPvQ_prO7asZ43MD7K7UO2OZpjh_bJjUTmIhRAYYIN0657MZDAG3mAi-HfJRhhyphenhyphenJgBba3LkScXFMXnHCLnN8LYBs2gZ3VcgoRAtC1I/s400/Terminal+connection3.jpg&quot; width=&quot;400&quot; /&gt;    &lt;/div&gt;&lt;br&gt;&amp;nbsp;     &lt;br&gt;    &lt;h3 style=&quot;color: #7FD4FF&quot;;&gt;Fritzing sketch&lt;/h3&gt;    The following diagram will show you how to wire everything together  &lt;br&gt;&amp;nbsp;     &lt;br&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8NBgQWzNlXkun6CCInM-RTBQ0m16Rn05Ly7-_CvFzLh4nqA0bEnWwccT7Fu71u9g4PfnVOggtHGYgxNQNTdak_KRqQcCZQdZbxknhm3Ihrc_qvar5GXQhSGSrpNYFIr6d-bNjV-I38CU/s1600/NeoPixel+Heart+Beat+Fritzing+sketch.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border:3px double white;&quot; height=&quot;398&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8NBgQWzNlXkun6CCInM-RTBQ0m16Rn05Ly7-_CvFzLh4nqA0bEnWwccT7Fu71u9g4PfnVOggtHGYgxNQNTdak_KRqQcCZQdZbxknhm3Ihrc_qvar5GXQhSGSrpNYFIr6d-bNjV-I38CU/s640/NeoPixel+Heart+Beat+Fritzing+sketch.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;(click to enlarge)&lt;/div&gt;    &lt;br&gt;   &lt;P&gt;   &lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;Arduino Power considerations&lt;/h3&gt;    Please note that the Arduino is powered by a USB cable. &lt;br&gt;    If you plan to power the Arduino from your power supply, you will need to disconnect the USB cable from the Arduino FIRST,     then connect a wire from the 5V line on the Power supply to the 5V pin on the Arduino. Do NOT connect the USB cable to the     Arduino while the 5V wire is connected to the Arduino.&lt;br&gt;&amp;nbsp;     &lt;br&gt;    &lt;br&gt;&amp;nbsp;     &lt;br&gt;    &lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;Large Capacitor&lt;/h3&gt;    &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide/power&quot;&gt;Adafruit&lt;/a&gt; also recommend the use of a large capacitor across the + and - terminals of the LED strip to &quot;prevent the      initial onrush of current from damaging the pixels&quot;. Adafruit recommends a capacitor that is 1000uF, 6.3V or higher.      I used a 4700uF 16V Electrolytic Capacitor. &lt;br&gt;&amp;nbsp;      &lt;br&gt;     &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;      &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCellhi2wus5If_epCVjjq3Afu4j0uRbY9As-WSbVobB8uixWQIDpNnSq5d8W6rnKYnJ8BxPhX-tdKjb2TS6wDeynUqsE8g9Fw7sCh5CJdmZ-4AYogmSoE0awyIHShRYfM22FYZD2pZHc/s400/Capacitor.jpg&quot; width=&quot;400&quot; /&gt;      &lt;/div&gt;     &lt;br&gt;&amp;nbsp;      &lt;br&gt;     &lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;Resistor on Data Pin&lt;/h3&gt;     Another recommendation from &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide/power&quot;&gt;Adafruit&lt;/a&gt; is to place a &quot;300 to 500 Ohm resistor&quot; between the Arduino&#39;s data pin and the data      input on the first NeoPixel to prevent voltage spikes that can damage the first pixel. I used a 330 Ohm resistor. &lt;br&gt; &amp;nbsp;      &lt;br&gt;     &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;      &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_n3kivI46_R-Z53JBf1QCnqFIyYzols4XOSE37Y_hjDIy3TWc-zONjyYn-Kt3RR6C-E0UhB62Fkuno1AZmtr3jjBx-yZDoi8RqMdxf0Qp4FuXy4rRR5uSQ0Td8iOy4kIJCaQCTra7400/s400/330+ohm+resistor.jpg&quot; width=&quot;400&quot; /&gt;      &lt;/div&gt;     &lt;br&gt;&amp;nbsp;      &lt;br&gt;     &lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;Grove Ear-clip heart rate sensor connection&lt;/h3&gt;     The Grove Base shield makes it easy to connect Grove modules to the Arduino. If you have a Grove Base shield,      you will need to connect the Ear-clip heart rate sensor to Digital pin 2 as per the diagram below. &lt;br&gt;&amp;nbsp;      &lt;br&gt;     &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmMYXph2UMX7XyscIZttM6-e1jzfdnimOnpHdCmr8pIoL8b3bCrLU0zS8wck0GNovI8vk57DRIJRFjynsZWiptl8EIuFy-q7qMs9Zjocnd4S4HLgwPCTavaY-gvzXDrGgq_SheH7oG0z0/s1600/Heart+Beat+Sensor+to+Grove+Base+Shield.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;        &lt;img style=&quot;border:3px double white;&quot; height=&quot;155&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmMYXph2UMX7XyscIZttM6-e1jzfdnimOnpHdCmr8pIoL8b3bCrLU0zS8wck0GNovI8vk57DRIJRFjynsZWiptl8EIuFy-q7qMs9Zjocnd4S4HLgwPCTavaY-gvzXDrGgq_SheH7oG0z0/s640/Heart+Beat+Sensor+to+Grove+Base+Shield.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;          &lt;/div&gt;&lt;br&gt;&amp;nbsp;      &lt;br&gt;     &lt;h3 style=&quot;color: #7FD4FF;&quot;&gt;Completed construction&lt;/h3&gt;     Once you have everything connected, you can plug the USB cable into the Arduino, and turn on the LED power supply.      Attach the ear-clip to your ear (or to your finger) and allow a few seconds to allow the sensor to register your pulse.       The LED strip will light up with every heart beat with an animation that moves from one end of the strip to the other in just three heart beats.      When the ear-clip is not connected to your ear or finger, the LEDs should remain off. However, the ear clip      may &quot;trigger&quot; a heart beat when opening or closing the clip.&lt;br&gt;&amp;nbsp;      &lt;br&gt;     Here is a picture of all the components (fully assembled).&lt;br&gt;&amp;nbsp;      &lt;br&gt;     &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;       &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5c2lrkOiNk70MXLmQOP-zqPbCkxTzZOw_IeIP7XfHg8jUeG5uijqVXom3YS7sSiyjYka12BUA8xrzSRJUGL7eep9EWWGSbcBcZ04A7cmiIC8qbhLmEUQNVmlxPigFcdQPTMaPd1CpiIo/s1600/Neopixel+circuit+real.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;         &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5c2lrkOiNk70MXLmQOP-zqPbCkxTzZOw_IeIP7XfHg8jUeG5uijqVXom3YS7sSiyjYka12BUA8xrzSRJUGL7eep9EWWGSbcBcZ04A7cmiIC8qbhLmEUQNVmlxPigFcdQPTMaPd1CpiIo/s640/Neopixel+circuit+real.jpg&quot; /&gt;&lt;/a&gt;     &lt;/div&gt;         &lt;/P&gt; &lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;P&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;H4&gt;Concluding comments&lt;/H4&gt; &lt;br&gt;  This very affordable LED strip allows you to create amazing animations over a greater distance. I thought that having less LEDs per metre   would make the animations look &quot;jittery&quot;, but I was wrong, they look amazing. One of the good things about this strip is the amount of space     between each Neopixel, allowing you to easily cut and join the strip to the size and shape you need. &lt;br&gt;&amp;nbsp;   &lt;br&gt;  This LED strip is compatible with the FastLED library, which makes for easy LED animation programming.   While I used this LED strip to display my heart beat, you could just as easily use it to display the output of any other sensor attached to the Arduino.&lt;br&gt; &amp;nbsp;   &lt;br&gt; &lt;/div&gt; &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;      &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxCJeJsH2A91Ne4qF-dFG0Q10GlPv1di_ygvOaIvSOvxoMV4tz9MQIlXLoZ8Nm16FZIlYAJ9u-U-VVokBUAw1RnlPz8BjgOsmaHYPlmLfdvdsrC3dcgDkBk1eauzn8VE4B_0rVOZ1N9zI/s400/NeoPixel+Heart+Beat+Reel.jpg&quot; width=&quot;640&quot; /&gt;  &lt;/div&gt; &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt; &lt;br&gt;&amp;nbsp; &lt;br&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;This project would not have been possible without &lt;a href=&quot;http://openlab.com.au/&quot;&gt;OpenLab&#39;s&lt;/a&gt; collaborative effort.&lt;br&gt;Please visit their site for more cool projects. &lt;/div&gt;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/365032789723354536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/07/neopixel-heart-beat-display.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/365032789723354536'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/365032789723354536'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/07/neopixel-heart-beat-display.html' title='NeoPixel Heart Beat Display'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWOHLusvd2Q18eg2pYmTIl8XNP8WW3PitYMXjq3E7XfSguUoR8ACQWnPijNxBne7htkhhTXGdEyImkv7zNMKO5Wjz72Btd0vtmqlPYI69Ehhs1O7EF887NVtil5yb6dvHhMYgCMKWLSQA/s72-c/Neopixel+Heart+Beat+Display+Title+image.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-1474454661102791211</id><published>2015-07-02T09:00:00.000+07:00</published><updated>2018-03-28T22:35:14.759+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="144 LED"/><category scheme="http://www.blogger.com/atom/ns#" term="accelerometer"/><category scheme="http://www.blogger.com/atom/ns#" term="adafruit"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="Comet"/><category scheme="http://www.blogger.com/atom/ns#" term="Cylon"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><category scheme="http://www.blogger.com/atom/ns#" term="Fire Starter"/><category scheme="http://www.blogger.com/atom/ns#" term="How to"/><category scheme="http://www.blogger.com/atom/ns#" term="Level"/><category scheme="http://www.blogger.com/atom/ns#" term="NeoPixels"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenLab"/><category scheme="http://www.blogger.com/atom/ns#" term="Playground"/><category scheme="http://www.blogger.com/atom/ns#" term="Potentiometer"/><category scheme="http://www.blogger.com/atom/ns#" term="power"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Sequence"/><category scheme="http://www.blogger.com/atom/ns#" term="Spirit"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>NeoPixel Playground</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;  &lt;div style=&quot;text-align: center;&quot;&gt;                &lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/POV-qvEx1ws?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;                &lt;/div&gt;&lt;br /&gt; &lt;/P&gt; &lt;P&gt;  &lt;div&gt;   &lt;P&gt;    The NeoPixel Digital RGB LED Strip (144 LED/m) is a really impressive product that will have you lighting up your room     in next to no time. The 144 individually addressable LEDs packed onto a 1 metre flexible water resistant strip, enables     a world of luminescent creativity that will blow your blinking Arduino friends away. The following tutorial will show you     how to create an immersive and interactive LED display using an Arduino UNO, a potentiometer and an accelerometer.                 There will be a total of FIVE LED sequences to keep you entertained or you can create your own ! &lt;br&gt; &amp;nbsp;                 &lt;br&gt;                This tutorial was specifically designed to work with the &lt;a href=&quot;http://openlab.com.au/shop/neopixel-digital-rgb-led-strip-144-led/&quot;&gt;144 Neopixel Digital RGB LED strip&lt;/a&gt; with the ws2812B chipset.                                  &lt;br&gt;                             &lt;BR /&gt;&amp;nbsp;                     &lt;/P&gt;  &lt;/div&gt;  &lt;/P&gt; &lt;P&gt;  &lt;H4&gt;Parts Required:&lt;/H4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/arduino-uno-rev3/&quot;&gt;Arduino UNO (or compatible board)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/658&quot;&gt;Adafruit 5V 10A switching power supply (PRODUCT ID: 658)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/neopixel-digital-rgb-led-strip-144-led/&quot;&gt;NeoPixel Digital RGB LED Strip (144 LED/m)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/sensor-assortment-pack/&quot;&gt;Potentiometer &lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.freetronics.com.au/products/3-axis-accelerometer-module#.VXR-1uaferg&quot;&gt;3-Axis Accelerometer Module&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/half-size-breadboard/&quot;&gt;Breadboard&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/breadboard-jumper-wire-set-140-pcs-pack/&quot;&gt;Breadboard jumper wire&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://openlab.com.au/shop/resk-resistor-kit/&quot;&gt;300 ohm resitor&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Passive-Components/Capacitors/Electrolytic/4700uF-16V-RB-Electrolytic-Capacitor---105oC/p/RE6243&quot;&gt;4700uF 16V Electrolytic Capacitor (Jaycar Cat No. RE6243)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Interconnect/Terminals-%26-Headers/Pluggable-Terminal-Blocks/6-Pole-PC-Mount-Pluggable-Header---5-08mm---Horizontal/p/HM3106&quot;&gt;6 Pole PC Mount Pluggable Header (Jaycar Cat No. HM3106)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Interconnect/Terminals-%26-Headers/Pluggable-Terminal-Blocks/6-Pole-PC-Mount-Pluggable-Terminal-Block-Socket---5-08mm/p/HM3126&quot;&gt;6 Pole PC Mount Pluggable Terminal Block Socket (Jaycar Cat No. HM3126)&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.jaycar.com.au/Service-Aids/Tapes/Other/Double-sided-Mounting-Tape---10m/p/NM2821&quot;&gt;Double Sided mounting tape - 10m (Jaycar Cat No. NM2821) - optional&lt;/a&gt;&lt;/li&gt;                &lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt; &lt;H4&gt;Power Requirements&lt;/H4&gt;    &lt;P&gt;        Before you start any LED strip project, the first thing you will need to think about is POWER. According to the &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide/power&quot;&gt;Adafruit website&lt;/a&gt;,         each individual NeoPixel LED can draw up to 60 milliamps at maximum brightness - white. Therefore the amount of current required for the entire strip will be way more than your Arduino can handle.         If you try to power this LED strip directly from your Arduino, you run the risk of damaging not only your Arduino, but your USB port as well. The Arduino will be used to control the LED strip,         but the LED strip will need to be powered by a separate power supply. The power supply you choose to use is important. It must provide the correct voltage, and must able to supply sufficient current.&lt;br&gt;  &amp;nbsp;         &lt;br&gt;           &lt;h3&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;Operating Voltage(5V)&lt;/span&gt;&lt;/h3&gt;           The operating voltage of the NeoPixel strip is 5 volts DC.  Excessive voltage will damage/destroy your NeoPixels. &lt;br&gt;           &lt;br&gt;           &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Current requirements (8.6 Amps)&lt;/h3&gt;&lt;/span&gt;           OpenLab recommend the use of a 5V 10A power supply. Having more Amps is OK, providing the output voltage is 5V DC.            The LEDs will only draw as much current as they need. To calculate the amount of current this 1m strip can draw with all LEDs turned on at full brightness - white: &lt;br&gt;        &lt;br&gt;        &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;144&lt;/span&gt; NeoPixel LEDs&lt;/span&gt;  x &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;60&lt;/span&gt; mA&lt;/span&gt; x &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;1&lt;/span&gt; m&lt;/span&gt;  =  &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;8640&lt;/span&gt; mA&lt;/span&gt; = &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;8.64&lt;/span&gt; Amps for a 1 metre strip.&lt;/span&gt;&lt;br&gt;        &lt;br&gt;        Therefore a 5V 10A power supply would be able to handle the maximum current (8.6 Amps) demanded by a single 1m NeoPixel strip of 144 LEDs. &lt;br&gt;&amp;nbsp;         &lt;br&gt; &amp;nbsp           &lt;br&gt; &lt;/P&gt;     &lt;P&gt;  &lt;H4&gt;Arduino Libraries and IDE&lt;/H4&gt;  &lt;BR /&gt;  Before you start to hook up any components, upload the following sketch to the Arduino microcontroller.         I am assuming that you already have the &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE&lt;/a&gt; installed on your computer. If not, the IDE can be downloaded from &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;here&lt;/a&gt;. &lt;br&gt; &amp;nbsp;   &lt;br&gt;  The &lt;a href=&quot;http://fastled.io/&quot;&gt;FastLED library&lt;/a&gt; is useful for simplifying the code for programming the NeoPixels.   The latest &quot;FastLED library&quot; can be downloaded from &lt;a href=&quot;https://github.com/FastLED/FastLED/releases&quot;&gt;here&lt;/a&gt;. I used FastLED library version &lt;a href=&quot;https://github.com/FastLED/FastLED/tree/3.0.3&quot;&gt;3.0.3&lt;/a&gt; in this project.&lt;br&gt;   &amp;nbsp;   &lt;br&gt;  If you have a different LED strip or your NeoPixels have a different chipset, make sure to change the relevant lines of code to accomodate your hardware.   I would suggest you try out a few of the &lt;a href=&quot;https://github.com/FastLED/FastLED/tree/3.0.3/examples&quot;&gt;FastLED library examples&lt;/a&gt; before using the code below, so that you become more familiar with the library, and   will be better equipped to make the necessary changes. If you have a single 144 NeoPixel LED/m strip with the ws2812B chipset, then you will not have to make   any modifications below (unless you want to).&lt;br&gt; &amp;nbsp;   &lt;br&gt;  &lt;h4&gt;ARDUINO CODE:&lt;/h4&gt;&lt;br&gt;  &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt; 1&lt;br /&gt; 2&lt;br /&gt; 3&lt;br /&gt; 4&lt;br /&gt; 5&lt;br /&gt; 6&lt;br /&gt; 7&lt;br /&gt; 8&lt;br /&gt; 9&lt;br /&gt;10&lt;br /&gt;11&lt;br /&gt;12&lt;br /&gt;13&lt;br /&gt;14&lt;br /&gt;15&lt;br /&gt;16&lt;br /&gt;17&lt;br /&gt;18&lt;br /&gt;19&lt;br /&gt;20&lt;br /&gt;21&lt;br /&gt;22&lt;br /&gt;23&lt;br /&gt;24&lt;br /&gt;25&lt;br /&gt;26&lt;br /&gt;27&lt;br /&gt;28&lt;br /&gt;29&lt;br /&gt;30&lt;br /&gt;31&lt;br /&gt;32&lt;br /&gt;33&lt;br /&gt;34&lt;br /&gt;35&lt;br /&gt;36&lt;br /&gt;37&lt;br /&gt;38&lt;br /&gt;39&lt;br /&gt;40&lt;br /&gt;41&lt;br /&gt;42&lt;br /&gt;43&lt;br /&gt;44&lt;br /&gt;45&lt;br /&gt;46&lt;br /&gt;47&lt;br /&gt;48&lt;br /&gt;49&lt;br /&gt;50&lt;br /&gt;51&lt;br /&gt;52&lt;br /&gt;53&lt;br /&gt;54&lt;br /&gt;55&lt;br /&gt;56&lt;br /&gt;57&lt;br /&gt;58&lt;br /&gt;59&lt;br /&gt;60&lt;br /&gt;61&lt;br /&gt;62&lt;br /&gt;63&lt;br /&gt;64&lt;br /&gt;65&lt;br /&gt;66&lt;br /&gt;67&lt;br /&gt;68&lt;br /&gt;69&lt;br /&gt;70&lt;br /&gt;71&lt;br /&gt;72&lt;br /&gt;73&lt;br /&gt;74&lt;br /&gt;75&lt;br /&gt;76&lt;br /&gt;77&lt;br /&gt;78&lt;br /&gt;79&lt;br /&gt;80&lt;br /&gt;81&lt;br /&gt;82&lt;br /&gt;83&lt;br /&gt;84&lt;br /&gt;85&lt;br /&gt;86&lt;br /&gt;87&lt;br /&gt;88&lt;br /&gt;89&lt;br /&gt;90&lt;br /&gt;91&lt;br /&gt;92&lt;br /&gt;93&lt;br /&gt;94&lt;br /&gt;95&lt;br /&gt;96&lt;br /&gt;97&lt;br /&gt;98&lt;br /&gt;99&lt;br /&gt;100&lt;br /&gt;101&lt;br /&gt;102&lt;br /&gt;103&lt;br /&gt;104&lt;br /&gt;105&lt;br /&gt;106&lt;br /&gt;107&lt;br /&gt;108&lt;br /&gt;109&lt;br /&gt;110&lt;br /&gt;111&lt;br /&gt;112&lt;br /&gt;113&lt;br /&gt;114&lt;br /&gt;115&lt;br /&gt;116&lt;br /&gt;117&lt;br /&gt;118&lt;br /&gt;119&lt;br /&gt;120&lt;br /&gt;121&lt;br /&gt;122&lt;br /&gt;123&lt;br /&gt;124&lt;br /&gt;125&lt;br /&gt;126&lt;br /&gt;127&lt;br /&gt;128&lt;br /&gt;129&lt;br /&gt;130&lt;br /&gt;131&lt;br /&gt;132&lt;br /&gt;133&lt;br /&gt;134&lt;br /&gt;135&lt;br /&gt;136&lt;br /&gt;137&lt;br /&gt;138&lt;br /&gt;139&lt;br /&gt;140&lt;br /&gt;141&lt;br /&gt;142&lt;br /&gt;143&lt;br /&gt;144&lt;br /&gt;145&lt;br /&gt;146&lt;br /&gt;147&lt;br /&gt;148&lt;br /&gt;149&lt;br /&gt;150&lt;br /&gt;151&lt;br /&gt;152&lt;br /&gt;153&lt;br /&gt;154&lt;br /&gt;155&lt;br /&gt;156&lt;br /&gt;157&lt;br /&gt;158&lt;br /&gt;159&lt;br /&gt;160&lt;br /&gt;161&lt;br /&gt;162&lt;br /&gt;163&lt;br /&gt;164&lt;br /&gt;165&lt;br /&gt;166&lt;br /&gt;167&lt;br /&gt;168&lt;br /&gt;169&lt;br /&gt;170&lt;br /&gt;171&lt;br /&gt;172&lt;br /&gt;173&lt;br /&gt;174&lt;br /&gt;175&lt;br /&gt;176&lt;br /&gt;177&lt;br /&gt;178&lt;br /&gt;179&lt;br /&gt;180&lt;br /&gt;181&lt;br /&gt;182&lt;br /&gt;183&lt;br /&gt;184&lt;br /&gt;185&lt;br /&gt;186&lt;br /&gt;187&lt;br /&gt;188&lt;br /&gt;189&lt;br /&gt;190&lt;br /&gt;191&lt;br /&gt;192&lt;br /&gt;193&lt;br /&gt;194&lt;br /&gt;195&lt;br /&gt;196&lt;br /&gt;197&lt;br /&gt;198&lt;br /&gt;199&lt;br /&gt;200&lt;br /&gt;201&lt;br /&gt;202&lt;br /&gt;203&lt;br /&gt;204&lt;br /&gt;205&lt;br /&gt;206&lt;br /&gt;207&lt;br /&gt;208&lt;br /&gt;209&lt;br /&gt;210&lt;br /&gt;211&lt;br /&gt;212&lt;br /&gt;213&lt;br /&gt;214&lt;br /&gt;215&lt;br /&gt;216&lt;br /&gt;217&lt;br /&gt;218&lt;br /&gt;219&lt;br /&gt;220&lt;br /&gt;221&lt;br /&gt;222&lt;br /&gt;223&lt;br /&gt;224&lt;br /&gt;225&lt;br /&gt;226&lt;br /&gt;227&lt;br /&gt;228&lt;br /&gt;229&lt;br /&gt;230&lt;br /&gt;231&lt;br /&gt;232&lt;br /&gt;233&lt;br /&gt;234&lt;br /&gt;235&lt;br /&gt;236&lt;br /&gt;237&lt;br /&gt;238&lt;br /&gt;239&lt;br /&gt;240&lt;br /&gt;241&lt;br /&gt;242&lt;br /&gt;243&lt;br /&gt;244&lt;br /&gt;245&lt;br /&gt;246&lt;br /&gt;247&lt;br /&gt;248&lt;br /&gt;249&lt;br /&gt;250&lt;br /&gt;251&lt;br /&gt;252&lt;br /&gt;253&lt;br /&gt;254&lt;br /&gt;255&lt;br /&gt;256&lt;br /&gt;257&lt;br /&gt;258&lt;br /&gt;259&lt;br /&gt;260&lt;br /&gt;261&lt;br /&gt;262&lt;br /&gt;263&lt;br /&gt;264&lt;br /&gt;265&lt;br /&gt;266&lt;br /&gt;267&lt;br /&gt;268&lt;br /&gt;269&lt;br /&gt;270&lt;br /&gt;271&lt;br /&gt;272&lt;br /&gt;273&lt;br /&gt;274&lt;br /&gt;275&lt;br /&gt;276&lt;br /&gt;277&lt;br /&gt;278&lt;br /&gt;279&lt;br /&gt;280&lt;br /&gt;281&lt;br /&gt;282&lt;br /&gt;283&lt;br /&gt;284&lt;br /&gt;285&lt;br /&gt;286&lt;br /&gt;287&lt;br /&gt;288&lt;br /&gt;289&lt;br /&gt;290&lt;br /&gt;291&lt;br /&gt;292&lt;br /&gt;293&lt;br /&gt;294&lt;br /&gt;295&lt;br /&gt;296&lt;br /&gt;297&lt;br /&gt;298&lt;br /&gt;299&lt;br /&gt;300&lt;br /&gt;301&lt;br /&gt;302&lt;br /&gt;303&lt;br /&gt;304&lt;br /&gt;305&lt;br /&gt;306&lt;br /&gt;307&lt;br /&gt;308&lt;br /&gt;309&lt;br /&gt;310&lt;br /&gt;311&lt;br /&gt;312&lt;br /&gt;313&lt;br /&gt;314&lt;br /&gt;315&lt;br /&gt;316&lt;br /&gt;317&lt;br /&gt;318   &lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;    &lt;pre style=&quot;margin: 0; line-height: 126%&quot;&gt;&lt;br /&gt;    &lt;!-- INSERT ARDUINO CODE HERE  --&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;/*&amp;nbsp;==================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;NeoPixel&amp;nbsp;Playground&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;Neopixel&amp;nbsp;chipset:&amp;nbsp;ws2812B&amp;nbsp;&amp;nbsp;(144&amp;nbsp;LED/m&amp;nbsp;strip)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;12th&amp;nbsp;June&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Arduino&amp;nbsp;IDE:&amp;nbsp;1.6.4&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;This&amp;nbsp;project&amp;nbsp;will&amp;nbsp;allow&amp;nbsp;you&amp;nbsp;to&amp;nbsp;cycle&amp;nbsp;through&amp;nbsp;and&amp;nbsp;control&amp;nbsp;five&amp;nbsp;LED&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;animation&amp;nbsp;sequences&amp;nbsp;using&amp;nbsp;a&amp;nbsp;potentiometer&amp;nbsp;and&amp;nbsp;an&amp;nbsp;accelerometer&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sequence&amp;nbsp;1:&amp;nbsp;&amp;nbsp;&amp;nbsp;Cylon&amp;nbsp;with&amp;nbsp;Hue&amp;nbsp;Control&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Control:&amp;nbsp;Potentiometer&amp;nbsp;only&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sequence&amp;nbsp;2:&amp;nbsp;&amp;nbsp;&amp;nbsp;Cylon&amp;nbsp;with&amp;nbsp;Brightness&amp;nbsp;Control&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Control:&amp;nbsp;Potentiometer&amp;nbsp;only&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sequence&amp;nbsp;3:&amp;nbsp;&amp;nbsp;&amp;nbsp;Comet&amp;nbsp;effect&amp;nbsp;with&amp;nbsp;Hue&amp;nbsp;and&amp;nbsp;direction&amp;nbsp;control&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Control:&amp;nbsp;Potentiometer&amp;nbsp;and&amp;nbsp;Accelerometer&amp;nbsp;(Y&amp;nbsp;axis&amp;nbsp;only)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sequence&amp;nbsp;4:&amp;nbsp;&amp;nbsp;&amp;nbsp;FireStarter&amp;nbsp;/&amp;nbsp;Rainbow&amp;nbsp;effect&amp;nbsp;with&amp;nbsp;Hue&amp;nbsp;and&amp;nbsp;Direction&amp;nbsp;control&amp;nbsp;&amp;nbsp;Control:&amp;nbsp;Potentiometer&amp;nbsp;and&amp;nbsp;Accelerometer&amp;nbsp;(Y&amp;nbsp;axis&amp;nbsp;only)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sequence&amp;nbsp;5:&amp;nbsp;&amp;nbsp;&amp;nbsp;Digital&amp;nbsp;Spirit&amp;nbsp;Level&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Control:&amp;nbsp;Accelerometer&amp;nbsp;only&amp;nbsp;(Y&amp;nbsp;axis)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;This&amp;nbsp;project&amp;nbsp;makes&amp;nbsp;use&amp;nbsp;of&amp;nbsp;the&amp;nbsp;FastLED&amp;nbsp;library.&amp;nbsp;Some&amp;nbsp;of&amp;nbsp;the&amp;nbsp;code&amp;nbsp;below&amp;nbsp;was&amp;nbsp;adapted&amp;nbsp;from&amp;nbsp;the&amp;nbsp;FastLED&amp;nbsp;library&amp;nbsp;examples&amp;nbsp;(eg.&amp;nbsp;Cylon&amp;nbsp;routine).&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;Comet,&amp;nbsp;FireStarter&amp;nbsp;and&amp;nbsp;Digital&amp;nbsp;Spirit&amp;nbsp;Level&amp;nbsp;sequence&amp;nbsp;was&amp;nbsp;designed&amp;nbsp;by&amp;nbsp;ScottC.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;FastLED&amp;nbsp;library&amp;nbsp;can&amp;nbsp;be&amp;nbsp;found&amp;nbsp;here:&amp;nbsp;http://fastled.io/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You&amp;nbsp;may&amp;nbsp;need&amp;nbsp;to&amp;nbsp;modify&amp;nbsp;the&amp;nbsp;code&amp;nbsp;below&amp;nbsp;to&amp;nbsp;accomodate&amp;nbsp;your&amp;nbsp;specific&amp;nbsp;LED&amp;nbsp;strip.&amp;nbsp;See&amp;nbsp;the&amp;nbsp;FastLED&amp;nbsp;library&amp;nbsp;site&amp;nbsp;for&amp;nbsp;more&amp;nbsp;details.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;=====================================================================================================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//This&amp;nbsp;project&amp;nbsp;needs&amp;nbsp;the&amp;nbsp;FastLED&amp;nbsp;library&amp;nbsp;-&amp;nbsp;link&amp;nbsp;in&amp;nbsp;the&amp;nbsp;description.&lt;/span&gt;&lt;br /&gt;#include&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;&quot;FastLED.h&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//The&amp;nbsp;total&amp;nbsp;number&amp;nbsp;of&amp;nbsp;LEDs&amp;nbsp;being&amp;nbsp;used&amp;nbsp;is&amp;nbsp;144&lt;/span&gt;&lt;br /&gt;#define&amp;nbsp;NUM_LEDS&amp;nbsp;144&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;The&amp;nbsp;data&amp;nbsp;pin&amp;nbsp;for&amp;nbsp;the&amp;nbsp;NeoPixel&amp;nbsp;strip&amp;nbsp;is&amp;nbsp;connected&amp;nbsp;to&amp;nbsp;digital&amp;nbsp;Pin&amp;nbsp;6&amp;nbsp;on&amp;nbsp;the&amp;nbsp;Arduino&lt;/span&gt;&lt;br /&gt;#define&amp;nbsp;DATA_PIN&amp;nbsp;6&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//Initialise&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;array,&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;Hue&amp;nbsp;(ledh)&amp;nbsp;array,&amp;nbsp;and&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;Brightness&amp;nbsp;(ledb)&amp;nbsp;array.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;CRGB&lt;/b&gt;&lt;/span&gt; leds[NUM_LEDS];&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; ledh[NUM_LEDS];&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; ledb[NUM_LEDS];&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//Pin&amp;nbsp;connections&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; potPin = A0;      &lt;span style=&quot;color: #434F54;&quot;&gt;// The potentiometer signal pin is connected to Arduino&#39;s Analog Pin 0&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; yPin = A4;        &lt;span style=&quot;color: #434F54;&quot;&gt;// Y pin on accelerometer is connected to Arduino&#39;s Analog Pin 4&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The accelerometer&#39;s X Pin and the Z Pin were not used in this sketch&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//Global&amp;nbsp;Variables&amp;nbsp;---------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; potVal;                &lt;span style=&quot;color: #434F54;&quot;&gt;// potVal:      stores the potentiometer signal value&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; prevPotVal=0;          &lt;span style=&quot;color: #434F54;&quot;&gt;// prevPotVal:  stores the previous potentiometer value&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; LEDSpeed=1;             &lt;span style=&quot;color: #434F54;&quot;&gt;// LEDSpeed:    stores the &quot;speed&quot; of the LED animation sequence&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; maxLEDSpeed = 50;       &lt;span style=&quot;color: #434F54;&quot;&gt;// maxLEDSpeed: identifies the maximum speed of the LED animation sequence&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; LEDAccel=0;             &lt;span style=&quot;color: #434F54;&quot;&gt;// LEDAccel:    stores the acceleration value of the LED animation sequence (to speed it up or slow it down)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; LEDPosition=72;         &lt;span style=&quot;color: #434F54;&quot;&gt;// LEDPosition: identifies the LED within the strip to modify (leading LED). The number will be between 0-143.  (Zero to NUM_LEDS-1)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; oldPos=0;               &lt;span style=&quot;color: #434F54;&quot;&gt;// oldPos:      holds the previous position of the leading LED&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; hue = 0;               &lt;span style=&quot;color: #434F54;&quot;&gt;// hue:         stores the leading LED&#39;s hue value&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; intensity = 150;       &lt;span style=&quot;color: #434F54;&quot;&gt;// intensity:   the default brightness of the leading LED&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; bright = 80;           &lt;span style=&quot;color: #434F54;&quot;&gt;// bright:      this variable is used to modify the brightness of the trailing LEDs&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; animationDelay = 0;     &lt;span style=&quot;color: #434F54;&quot;&gt;// animationDelay: is used in the animation Speed calculation. The greater the animationDelay, the slower the LED sequence.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; effect = 0;             &lt;span style=&quot;color: #434F54;&quot;&gt;// effect:      is used to differentiate and select one out of the four effects&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; sparkTest = 0;          &lt;span style=&quot;color: #434F54;&quot;&gt;// sparkTest:   variable used in the &quot;sparkle&quot; LED animation sequence &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;boolean&lt;/span&gt; constSpeed = &lt;span style=&quot;color: #00979C;&quot;&gt;false&lt;/span&gt;; &lt;span style=&quot;color: #434F54;&quot;&gt;// constSpeed:  toggle between constant and variable speed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;setup()&amp;nbsp;:&amp;nbsp;Is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;initialise&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;strip&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #5E6D03;&quot;&gt;setup&lt;/span&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;delay&lt;/span&gt;(2000);          &lt;span style=&quot;color: #434F54;&quot;&gt;//Delay for two seconds to power the LEDS before starting the data signal on the Arduino&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;FastLED&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #D35400;&quot;&gt;addLeds&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #006699;&quot;&gt;WS2812B&lt;/span&gt;, DATA_PIN, &lt;span style=&quot;color: #006699;&quot;&gt;GRB&lt;/span&gt;&amp;gt;(leds, NUM_LEDS);                            &lt;span style=&quot;color: #434F54;&quot;&gt;//initialise the LED strip       &lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;loop()&amp;nbsp;:&amp;nbsp;The&amp;nbsp;Arduino&amp;nbsp;will&amp;nbsp;take&amp;nbsp;readings&amp;nbsp;from&amp;nbsp;the&amp;nbsp;potentiometer&amp;nbsp;and&amp;nbsp;accelerometer&amp;nbsp;to&amp;nbsp;control&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;strip&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #5E6D03;&quot;&gt;loop&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;readPotentiometer();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;adjustSpeed();&lt;br /&gt;&amp;nbsp;&amp;nbsp;constrainLEDs();&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;switch&lt;/span&gt;(effect){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;case&lt;/span&gt; 0:                                               &lt;span style=&quot;color: #434F54;&quot;&gt;// 1st effect : Cylon with Hue control - using Potentiometer &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cylonWithHueControl();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;case&lt;/span&gt; 1:                                               &lt;span style=&quot;color: #434F54;&quot;&gt;// 2nd effect : Cylon with Brightness control - using Potentiometer&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cylonWithBrightnessControl();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;case&lt;/span&gt; 2:                                               &lt;span style=&quot;color: #434F54;&quot;&gt;// 3rd effect : Comet effect. Hue controlled by potentiometer, direction by accelerometer&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cometEffect();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;case&lt;/span&gt; 3:                                               &lt;span style=&quot;color: #434F54;&quot;&gt;// 4th effect : FireStarter / Rainbow Sparkle effect. Direction controlled by accelerometer, sparkle by potentiometer.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fireStarter();&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;case&lt;/span&gt; 4:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;levelSense();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// 5th effect : LevelSense - uses the accelerometer to create a digital &quot;spirit&quot; level.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;readPotentiometer()&amp;nbsp;:&amp;nbsp;Take&amp;nbsp;a&amp;nbsp;potentiometer&amp;nbsp;reading.&amp;nbsp;This&amp;nbsp;value&amp;nbsp;will&amp;nbsp;be&amp;nbsp;used&amp;nbsp;to&amp;nbsp;control&amp;nbsp;various&amp;nbsp;LED&amp;nbsp;animations,&amp;nbsp;and&amp;nbsp;to&amp;nbsp;choose&amp;nbsp;the&amp;nbsp;animation&amp;nbsp;sequence&amp;nbsp;to&amp;nbsp;display.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; readPotentiometer(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//Take a reading from the potentiometer and convert the value into a number between 0 and 255&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;potVal&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;map&lt;/span&gt;(&lt;span style=&quot;color: #D35400;&quot;&gt;analogRead&lt;/span&gt;(potPin), 0, 1023 , 0, 255);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// If the potentiometer reading is equal to zero, then move to the next effect in the list.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(potVal==0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(prevPotVal&amp;gt;0){   &lt;span style=&quot;color: #434F54;&quot;&gt;// This allows us to switch effects only when the potentiometer reading has changed to zero (from a positive number). Multiple zero readings will be ignored.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;prevPotVal&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Set the prev pot value to zero in order to ignore replicate zero readings.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;effect++;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Go to the next effect.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(effect&amp;gt;4){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;effect=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Go back to the first effect after the fifth effect.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;prevPotVal=potVal;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Keep track of the previous potentiometer reading&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;adjustSpeed()&amp;nbsp;:&amp;nbsp;use&amp;nbsp;the&amp;nbsp;Y&amp;nbsp;axis&amp;nbsp;value&amp;nbsp;of&amp;nbsp;the&amp;nbsp;accelerometer&amp;nbsp;to&amp;nbsp;adjust&amp;nbsp;the&amp;nbsp;speed&amp;nbsp;and&amp;nbsp;the&amp;nbsp;direction&amp;nbsp;of&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;animation&amp;nbsp;sequence&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; adjustSpeed(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Take a reading from the Y Pin of the accelerometer and adjust the value so that &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// positive numbers move in one direction, and negative numbers move in the opposite diraction. &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// We use the map function to convert the accelerometer readings, and the constrain function to ensure that it stays within the desired limits&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The values of 230 and 640 were determined by trial and error and are specific to my accelerometer. You will need to adjust these numbers to suit your module.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;LEDAccel&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;constrain&lt;/span&gt;(&lt;span style=&quot;color: #D35400;&quot;&gt;map&lt;/span&gt;(&lt;span style=&quot;color: #D35400;&quot;&gt;analogRead&lt;/span&gt;(yPin), 230, 640 , maxLEDSpeed, -maxLEDSpeed),-maxLEDSpeed, maxLEDSpeed);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// If the constSpeed variable is &quot;true&quot;, then make sure that the speed of the animation is constant by modifying the LEDSpeed and LEDAccel variables.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(constSpeed){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDAccel=0;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(LEDSpeed&amp;gt;0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDSpeed&amp;nbsp;=&amp;nbsp;maxLEDSpeed/1.1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Adjust the LEDSpeed to half the maximum speed in the positive direction&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt; (LEDSpeed&amp;lt;0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDSpeed&amp;nbsp;=&amp;nbsp;-maxLEDSpeed/1.1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Adjust the LEDSpeed to half the maximum speed in the negative direction&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The Speed of the LED animation sequence can increase (accelerate), decrease (decelerate) or stay the same (constant speed)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;LEDSpeed&amp;nbsp;=&amp;nbsp;LEDSpeed&amp;nbsp;+&amp;nbsp;LEDAccel;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//The following lines of code are used to control the direction of the LED animation sequence, and limit the speed of that animation. &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt; (LEDSpeed&amp;gt;0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDPosition++;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Illuminate the LED in the Next position&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt; (LEDSpeed&amp;gt;maxLEDSpeed){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDSpeed=maxLEDSpeed;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Ensure that the speed does not go beyond the maximum speed in the positive direction&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt; (LEDSpeed&amp;lt;0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDPosition--;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Illuminate the LED in the Prior position&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt; (LEDSpeed&amp;lt;-maxLEDSpeed){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDSpeed&amp;nbsp;=&amp;nbsp;-maxLEDSpeed;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Ensure that the speed does not go beyond the maximum speed in the negative direction&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;constrainLEDs()&amp;nbsp;:&amp;nbsp;This&amp;nbsp;ensures&amp;nbsp;that&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;animation&amp;nbsp;sequence&amp;nbsp;remains&amp;nbsp;within&amp;nbsp;the&amp;nbsp;boundaries&amp;nbsp;of&amp;nbsp;the&amp;nbsp;various&amp;nbsp;arrays&amp;nbsp;(and&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;strip)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;and&amp;nbsp;it&amp;nbsp;also&amp;nbsp;creates&amp;nbsp;a&amp;nbsp;&quot;bouncing&quot;&amp;nbsp;effect&amp;nbsp;at&amp;nbsp;both&amp;nbsp;ends&amp;nbsp;of&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;strip.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; constrainLEDs(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;LEDPosition&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;constrain&lt;/span&gt;(LEDPosition, 0, NUM_LEDS-1);    &lt;span style=&quot;color: #434F54;&quot;&gt;// Make sure that the LEDs stay within the boundaries of the LED strip&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(LEDPosition == 0 || LEDPosition == NUM_LEDS-1) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDSpeed&amp;nbsp;=&amp;nbsp;(LEDSpeed&amp;nbsp;*&amp;nbsp;-0.9);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Reverse the direction of movement when LED gets to end of strip. This creates a bouncing ball effect.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;cylonWithHueControl()&amp;nbsp;:&amp;nbsp;&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;1st&amp;nbsp;LED&amp;nbsp;effect.&amp;nbsp;The&amp;nbsp;cylon&amp;nbsp;colour&amp;nbsp;is&amp;nbsp;controlled&amp;nbsp;by&amp;nbsp;the&amp;nbsp;potentiometer.&amp;nbsp;The&amp;nbsp;speed&amp;nbsp;is&amp;nbsp;constant.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; cylonWithHueControl(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;constSpeed&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #00979C;&quot;&gt;true&lt;/span&gt;;                                  &lt;span style=&quot;color: #434F54;&quot;&gt;// Make the LED animation speed constant&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;showLED(LEDPosition,&amp;nbsp;potVal,&amp;nbsp;255,&amp;nbsp;intensity);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Illuminate the LED&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fadeLEDs(8);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Fade LEDs by a value of 8. Higher numbers will create a shorter tail.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setDelay(LEDSpeed);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The LEDSpeed is constant, so the delay is constant&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;cylonWithBrightnessControl()&amp;nbsp;:&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;2nd&amp;nbsp;LED&amp;nbsp;effect.&amp;nbsp;The&amp;nbsp;cylon&amp;nbsp;colour&amp;nbsp;is&amp;nbsp;red&amp;nbsp;(hue=0),&amp;nbsp;and&amp;nbsp;the&amp;nbsp;brightness&amp;nbsp;is&amp;nbsp;controlled&amp;nbsp;by&amp;nbsp;the&amp;nbsp;potentiometer&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; cylonWithBrightnessControl(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;constSpeed&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #00979C;&quot;&gt;true&lt;/span&gt;;                                  &lt;span style=&quot;color: #434F54;&quot;&gt;// Make speed constant&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;showLED(LEDPosition,&amp;nbsp;0,&amp;nbsp;255,&amp;nbsp;potVal);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Brightness is controlled by potentiometer.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fadeLEDs(16);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Fade LEDs by a value of 16&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setDelay(LEDSpeed);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The LEDSpeed is constant, so the delay is constant&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;cometEffect()&amp;nbsp;:&amp;nbsp;&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;3rd&amp;nbsp;LED&amp;nbsp;effect.&amp;nbsp;The&amp;nbsp;random&amp;nbsp;brightness&amp;nbsp;of&amp;nbsp;the&amp;nbsp;trailing&amp;nbsp;LEDs&amp;nbsp;produces&amp;nbsp;an&amp;nbsp;interesting&amp;nbsp;comet-like&amp;nbsp;effect.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; cometEffect(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;constSpeed&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #00979C;&quot;&gt;false&lt;/span&gt;;                                  &lt;span style=&quot;color: #434F54;&quot;&gt;// The speed will be controlled by the slope of the accelerometer (y-Axis)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;showLED(LEDPosition,&amp;nbsp;potVal,&amp;nbsp;255,&amp;nbsp;intensity);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Hue will change with potentiometer.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//The following lines create the comet effect &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bright&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;random&lt;/span&gt;(50, 100);                            &lt;span style=&quot;color: #434F54;&quot;&gt;// Randomly select a brightness between 50 and 100&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;leds[LEDPosition]&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;CHSV&lt;/b&gt;&lt;/span&gt;((potVal+40),255, bright);   &lt;span style=&quot;color: #434F54;&quot;&gt;// The trailing LEDs will have a different hue to the leading LED, and will have a random brightness&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fadeLEDs(8);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// This will affect the length of the Trailing LEDs&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setDelay(LEDSpeed);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The LEDSpeed will be affected by the slope of the Accelerometer&#39;s y-Axis&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;fireStarter()&amp;nbsp;:&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;4th&amp;nbsp;LED&amp;nbsp;effect.&amp;nbsp;It&amp;nbsp;starts&amp;nbsp;off&amp;nbsp;looking&amp;nbsp;like&amp;nbsp;a&amp;nbsp;ball&amp;nbsp;of&amp;nbsp;fire,&amp;nbsp;leaving&amp;nbsp;a&amp;nbsp;trail&amp;nbsp;of&amp;nbsp;little&amp;nbsp;fires.&amp;nbsp;But&amp;nbsp;as&amp;nbsp;you&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;turn&amp;nbsp;the&amp;nbsp;potentiometer,&amp;nbsp;it&amp;nbsp;becomes&amp;nbsp;more&amp;nbsp;like&amp;nbsp;a&amp;nbsp;shooting&amp;nbsp;star&amp;nbsp;with&amp;nbsp;a&amp;nbsp;rainbow-sparkle&amp;nbsp;trail.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; fireStarter(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;constSpeed&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #00979C;&quot;&gt;false&lt;/span&gt;;                                  &lt;span style=&quot;color: #434F54;&quot;&gt;// The speed will be controlled by the slope of the accelerometer (y-Axis)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledh[LEDPosition]&amp;nbsp;=&amp;nbsp;potVal;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Hue is controlled by potentiometer&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;showLED(LEDPosition,&amp;nbsp;ledh[LEDPosition],&amp;nbsp;255,&amp;nbsp;intensity);&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//The following lines create the fire starter effect&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bright&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;random&lt;/span&gt;(50, 100);                            &lt;span style=&quot;color: #434F54;&quot;&gt;// Randomly select a brightness between 50 and 100&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledb[LEDPosition]&amp;nbsp;=&amp;nbsp;bright;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Assign this random brightness value to the trailing LEDs&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sparkle(potVal/5);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Call the sparkle routine to create that sparkling effect. The potentiometer controls the difference in hue from LED to LED.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fadeLEDs(1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// A low number creates a longer tail&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setDelay(LEDSpeed);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The LEDSpeed will be affected by the slope of the Accelerometer&#39;s y-Axis&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;levelSense()&amp;nbsp;:&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;5th&amp;nbsp;and&amp;nbsp;final&amp;nbsp;LED&amp;nbsp;effect.&amp;nbsp;The&amp;nbsp;accelerometer&amp;nbsp;is&amp;nbsp;used&amp;nbsp;in&amp;nbsp;conjunction&amp;nbsp;with&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;strip&amp;nbsp;to&amp;nbsp;create&amp;nbsp;a&amp;nbsp;digital&amp;nbsp;&quot;Spirit&quot;&amp;nbsp;Level.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You&amp;nbsp;can&amp;nbsp;use&amp;nbsp;the&amp;nbsp;illuminated&amp;nbsp;LEDs&amp;nbsp;to&amp;nbsp;identify&amp;nbsp;the&amp;nbsp;angle&amp;nbsp;of&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;strip&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; levelSense(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;constSpeed&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #00979C;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDPosition&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;constrain&lt;/span&gt;(&lt;span style=&quot;color: #D35400;&quot;&gt;map&lt;/span&gt;(&lt;span style=&quot;color: #D35400;&quot;&gt;analogRead&lt;/span&gt;(yPin), 230, 640, 1, NUM_LEDS-1), 0 , NUM_LEDS-1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//Jitter correction: this will reduce the amount of jitter caused by the accelerometer reading variability&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #D35400;&quot;&gt;abs&lt;/span&gt;(LEDPosition-oldPos) &amp;lt; 2){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEDPosition&amp;nbsp;=&amp;nbsp;oldPos;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//The following lines of code will ensure the colours remain within the red to green range, with green in the middle and red at the ends.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hue&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;map&lt;/span&gt;(LEDPosition, 0, NUM_LEDS-1, 0, 200);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt; (hue&amp;gt;100){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hue&amp;nbsp;=&amp;nbsp;200&amp;nbsp;-&amp;nbsp;hue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//Illuminate 2 LEDs next to each other&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;showLED(LEDPosition,&amp;nbsp;hue,&amp;nbsp;255,&amp;nbsp;intensity);&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;showLED(LEDPosition-1,&amp;nbsp;hue,&amp;nbsp;255,&amp;nbsp;intensity);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//If the position moves, then fade the old LED positions by a factor of 25 (high numbers mean shorter tail)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fadeLEDs(25);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oldPos&amp;nbsp;=&amp;nbsp;LEDPosition;&amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;fadeLEDs():&amp;nbsp;This&amp;nbsp;function&amp;nbsp;is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;fade&amp;nbsp;the&amp;nbsp;LEDs&amp;nbsp;back&amp;nbsp;to&amp;nbsp;black&amp;nbsp;(OFF)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; fadeLEDs(&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; fadeVal){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; i = 0; i&amp;lt;NUM_LEDS; i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;leds[i].&lt;span style=&quot;color: #D35400;&quot;&gt;fadeToBlackBy&lt;/span&gt;( fadeVal );&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;showLED()&amp;nbsp;:&amp;nbsp;is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;illuminate&amp;nbsp;the&amp;nbsp;LEDs&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; showLED(&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; pos, &lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; LEDhue, &lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; LEDsat, &lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; LEDbright){&lt;br /&gt;&amp;nbsp;&amp;nbsp;leds[pos]&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;CHSV&lt;/b&gt;&lt;/span&gt;(LEDhue,LEDsat,LEDbright);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;FastLED&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #D35400;&quot;&gt;show&lt;/span&gt;();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;setDelay()&amp;nbsp;:&amp;nbsp;is&amp;nbsp;where&amp;nbsp;the&amp;nbsp;speed&amp;nbsp;of&amp;nbsp;the&amp;nbsp;LED&amp;nbsp;animation&amp;nbsp;sequence&amp;nbsp;is&amp;nbsp;controlled.&amp;nbsp;The&amp;nbsp;speed&amp;nbsp;of&amp;nbsp;the&amp;nbsp;animation&amp;nbsp;is&amp;nbsp;controlled&amp;nbsp;by&amp;nbsp;the&amp;nbsp;LEDSpeed&amp;nbsp;variable.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;and&amp;nbsp;cannot&amp;nbsp;go&amp;nbsp;faster&amp;nbsp;than&amp;nbsp;the&amp;nbsp;maxLEDSpeed&amp;nbsp;variable.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; setDelay(&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; LSpeed){&lt;br /&gt;&amp;nbsp;&amp;nbsp;animationDelay&amp;nbsp;=&amp;nbsp;maxLEDSpeed&amp;nbsp;-&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;abs&lt;/span&gt;(LSpeed);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;delay&lt;/span&gt;(animationDelay);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;sparkle()&amp;nbsp;:&amp;nbsp;is&amp;nbsp;used&amp;nbsp;by&amp;nbsp;the&amp;nbsp;fireStarter&amp;nbsp;routine&amp;nbsp;to&amp;nbsp;create&amp;nbsp;a&amp;nbsp;sparkling/fire-like&amp;nbsp;effect&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Each&amp;nbsp;LED&amp;nbsp;hue&amp;nbsp;and&amp;nbsp;brightness&amp;nbsp;is&amp;nbsp;monitored&amp;nbsp;and&amp;nbsp;modified&amp;nbsp;using&amp;nbsp;arrays&amp;nbsp;&amp;nbsp;(ledh[]&amp;nbsp;&amp;nbsp;and&amp;nbsp;ledb[])&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;//===================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; sparkle(&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; hDiff){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; NUM_LEDS; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledh[i]&amp;nbsp;=&amp;nbsp;ledh[i]&amp;nbsp;+&amp;nbsp;hDiff;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// hDiff controls the extent to which the hue changes along the trailing LEDs&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// This will prevent &quot;negative&quot; brightness.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(ledb[i]&amp;lt;3){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledb[i]=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// The probability of &quot;re-igniting&quot; an LED will decrease as you move along the tail&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;// Once the brightness reaches zero, it cannot be re-ignited unless the leading LED passes over it again.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(ledb[i]&amp;gt;0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledb[i]=ledb[i]-2;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sparkTest&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;random&lt;/span&gt;(0,bright);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(sparkTest&amp;gt;(bright-(ledb[i]/1.1))){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledb[i]&amp;nbsp;=&amp;nbsp;bright;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledb[i]&amp;nbsp;=&amp;nbsp;ledb[i]&amp;nbsp;/&amp;nbsp;2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;leds[i]&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;CHSV&lt;/b&gt;&lt;/span&gt;(ledh[i],255,ledb[i]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;    &lt;!--         End of Arduino Code --&gt;    &lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt;     &lt;br&gt; &amp;nbsp;     &lt;br&gt; &lt;P&gt;  &lt;h4&gt;NeoPixel Strip connection &lt;/h4&gt;  &lt;P&gt;            The NeoPixel strip is rolled up when you first get it. You will notice that there are wires on both sides of the strip.       This allows you to chain LED strips together to make longer strips. The more LEDs you have, the more current you will need.             Connect your Arduino and power supply to the left side of the strip, with the arrows pointing to the right side of the strip.             &lt;br clear=&quot;all&quot;&gt;  &amp;nbsp;             &lt;br&gt;        &lt;/P&gt;        &lt;P&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-dFr3Md2Ycpa6WzUNjtXVXT82YOPed5mNyKyOklZxZqEYEYnnTVAceuXlV-6wh2PTART7AYzMJ9Rf1OCXJ_n-GC-mY7JNuynfDz35OVClGSU1xeC5-dnAjLkP9LNFrEkuaWAJEZ_QP9M/s1600/Rolled+up+Neopixels.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-dFr3Md2Ycpa6WzUNjtXVXT82YOPed5mNyKyOklZxZqEYEYnnTVAceuXlV-6wh2PTART7AYzMJ9Rf1OCXJ_n-GC-mY7JNuynfDz35OVClGSU1xeC5-dnAjLkP9LNFrEkuaWAJEZ_QP9M/s320/Rolled+up+Neopixels.jpg&quot; width=&quot;300&quot; align=&quot;top&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;        &lt;/P&gt;         &lt;P&gt;        &lt;h3&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;Follow the Arrows&lt;/span&gt;&lt;/h3&gt;        The arrows are quite hard to see on this particular LED strip because they are so small, plus they are located         right under the thicker part of the NeoPixel weatherproof sheath. I have circled the arrows in RED so that you know where to look:&lt;br&gt;        &lt;br clear=&quot;all&quot;&gt;  &amp;nbsp;         &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBJiuC-v95CikFgTyn4KmcicandRSctkSGxdwz2FI3Bw6ocFWOwSAWGLVJRB-a56p4JdW7Mcm92hU-Dn8NlSBawTn5fR8-hQwFgW81KbJg2HWwCmkOlN03Diu0Xlezm3aUAahlsA3e2zI/s1600/NeoPixel+Arrows.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBJiuC-v95CikFgTyn4KmcicandRSctkSGxdwz2FI3Bw6ocFWOwSAWGLVJRB-a56p4JdW7Mcm92hU-Dn8NlSBawTn5fR8-hQwFgW81KbJg2HWwCmkOlN03Diu0Xlezm3aUAahlsA3e2zI/s400/NeoPixel+Arrows.jpg&quot; width=&quot;400&quot; /&gt;            &lt;/a&gt;            &lt;/div&gt;            &lt;br /&gt;  &lt;/P&gt; &lt;/P&gt;    &lt;br clear=&quot;all&quot;&gt;  &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;P&gt;&lt;h3&gt;NeoPixel Strip Wires&lt;/h3&gt;&lt;/span&gt;  There are 4 wires coming from either side of the NeoPixel LED strip: &lt;br&gt;  &amp;nbsp;   &lt;br&gt;        &amp;nbsp;&amp;nbsp;One red wire, one white wire, and two black wires.&lt;br&gt; &amp;nbsp;         &lt;br&gt;  It doesn&#39;t matter which Black wire you use to connect to the power supply (or Arduino) GND. Both black wires appear to be going to the         same pin on the LED strip anyway. Use the table below to make the necessary NeoPixel Strip connections to the Arduino and power supply.&lt;br&gt;         &lt;br clear=&quot;all&quot;&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyaRQO7k33yrqofcGDhK7rBvaJDL_uBDutD3-XUONtgPYj8ADrF2G9dv9WSKkJaHTk9HXRSvH9a28V5SP8jfSmT6LksninKbbvLGsVB2h0KoRkIL7f2po493Jz8cWDspfSOaWGqQsZ8W4/s1600/NeoPixel+Table3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img border=&quot;0&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyaRQO7k33yrqofcGDhK7rBvaJDL_uBDutD3-XUONtgPYj8ADrF2G9dv9WSKkJaHTk9HXRSvH9a28V5SP8jfSmT6LksninKbbvLGsVB2h0KoRkIL7f2po493Jz8cWDspfSOaWGqQsZ8W4/s640/NeoPixel+Table3.jpg&quot; width=&quot;640&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;&lt;br /&gt;        &lt;/P&gt;        &lt;P&gt;         &lt;h3&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;Large Capacitor&lt;/span&gt;&lt;/h3&gt;        &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide/power&quot;&gt;Adafruit&lt;/a&gt; also recommend the use of a large capacitor across the + and - terminals of the LED strip to &quot;prevent the            initial onrush of current from damaging the pixels&quot;. Adafruit recommends a capacitor that is 1000uF, 6.3V or higher.            I used a 4700uF 16V Electrolytic Capacitor. &lt;br&gt;           &lt;br&gt;           &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Resistor on Data Pin&lt;/h3&gt;&lt;/span&gt;           Another recommendation from &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide/power&quot;&gt;Adafruit&lt;/a&gt; is to place a &quot;300 to 500 Ohm resistor&quot; between the Arduino&#39;s data pin and the data            input on the first NeoPixel to prevent voltage spikes that can damage the first pixel. I used a 330 Ohm resistor. &lt;br&gt; &amp;nbsp;            &lt;br&gt;           &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Powering your Arduino (USB vs Power supply)&lt;/h3&gt;&lt;/span&gt;           You can power your Arduino board via USB cable or via the LED strip power supply.&lt;br&gt;           &lt;span style=&quot;color: #7FD4FF;&quot;&gt;*** Please note:&lt;/span&gt; different power supplies will yield different accelerometer readings. I noticed this when changing the Arduino&#39;s power source from USB to LED power supply.            My final sketch was designed to eliminate the USB/computer connection, hence I have chosen to power the Arduino via the power supply.            The fritzing sketch below shows the Arduino being powered by a power supply only. &lt;br&gt;           &lt;br&gt;           &lt;span style=&quot;color: #FF0000;&quot;&gt;&lt;b&gt;**WARNING:&lt;/b&gt;&lt;/span&gt; If you decide to power your Arduino UNO via a USB cable, please make sure to remove (or disconnect) the wire that goes to the             the Arduino VIN pin.  The GND connections remain unchanged.        &lt;/P&gt;         &lt;br&gt;        &lt;P&gt;&lt;H4&gt;Fritzing Sketch - NeoPixel strip connection&lt;/H4&gt;        &lt;/P&gt;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN3fLG-qU5o0OLgPoLeFd0JlPTNtWqIXQjtGNcWikex3MRrNKc24FVbE-qrl9lcvdJhmxVcHt-2GgHLwx297nYDkVIKJISnZBdXlBUXKoEyY9Hm7qMxKg8iczmD2fPoD8kElwaM9wEcBQ/s1600/NeoPixel+Fritzing+Sketch1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot;  height=&quot;478&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN3fLG-qU5o0OLgPoLeFd0JlPTNtWqIXQjtGNcWikex3MRrNKc24FVbE-qrl9lcvdJhmxVcHt-2GgHLwx297nYDkVIKJISnZBdXlBUXKoEyY9Hm7qMxKg8iczmD2fPoD8kElwaM9wEcBQ/s640/NeoPixel+Fritzing+Sketch1.jpg&quot; width=&quot;640&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;        &lt;br /&gt; &amp;nbsp;         &lt;br&gt;        &lt;h4&gt;Potentiometer connection&lt;/h4&gt;        &lt;P&gt;The potentiometer will be used to switch between the different LED sequences. When it reads zero, it will switch to         the next sequence in the list. It will jump right back to the beginning after the last sequence.         The potentiometer is also used to interact with the LEDs (e.g. controlling hue, brightness etc etc).         &lt;br&gt;        See the fritzing sketch below to add the potentiometer to this project.&lt;/P&gt;        &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicuD8CrVhDMu9z6Ev4B5S41jduLQWbpFLYmoi_tK5ob2ci5fa1_Zxyg-29G75z3nVqa1tD-A1h0_jbZ0ZJm7DJhW5JNAnpNvQy8gXjSkt3P931KMuLRO9jfVMn22_ofJBGq9rckQAQhmc/s1600/Potentiometer+Fritzing.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot;  height=&quot;512&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicuD8CrVhDMu9z6Ev4B5S41jduLQWbpFLYmoi_tK5ob2ci5fa1_Zxyg-29G75z3nVqa1tD-A1h0_jbZ0ZJm7DJhW5JNAnpNvQy8gXjSkt3P931KMuLRO9jfVMn22_ofJBGq9rckQAQhmc/s640/Potentiometer+Fritzing.jpg&quot; width=&quot;640&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;        &lt;br /&gt;  &amp;nbsp;         &lt;br&gt;        &lt;h4&gt;Accelerometer connection (Y-axis)&lt;/h4&gt;        &lt;P&gt;The accelerometer makes the LEDs much more fun and interactive. We will only be using the Y-axis of the accelerometer in this sketch. By tilting the accelerometer from one side to the other, the LEDs react and respond accordingly.             The accelerometer is an essential component of the digital spirit level sequence. That&#39;s right ! You can use this sketch             to create your own spirit level. This digital version can also be used to measure angles ! &lt;br&gt;&amp;nbsp;             &lt;br&gt;            Have a look below to see how to hook up the accelerometer to the Arduino. The Y-axis is connected to the Arduino analog pin 4.             If you wanted to use the X and Z axis, connect them to one of the other available analog pins (eg. A3 and A5). &lt;/P&gt;        &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6H7R1bWzmjcprrRGK2_jm6m1RNR4nQsJk_JwAdC35_enJG_PTgT43C0sjTnDtAV9ae6QAXTpIGx1jAd1tp0SCyCnebBzpci-N8mqwtUYGFIZRWUA1hHTb73bN5oS-Hfc-I4NzCtNQ9Dk/s1600/Accelerometer+Fritzing.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot;  height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6H7R1bWzmjcprrRGK2_jm6m1RNR4nQsJk_JwAdC35_enJG_PTgT43C0sjTnDtAV9ae6QAXTpIGx1jAd1tp0SCyCnebBzpci-N8mqwtUYGFIZRWUA1hHTb73bN5oS-Hfc-I4NzCtNQ9Dk/s640/Accelerometer+Fritzing.jpg&quot; width=&quot;630&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;        &lt;br /&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;     &lt;h4&gt;Let the fun begin !!&lt;/h4&gt;     Now that you have the Arduino code uploaded to the Arduino, and have made all of the necessary wire/component connections,      it is time to turn on the power supply. &lt;br&gt; &amp;nbsp;      &lt;br&gt;         &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Sequence 1: Cylon with Hue control&lt;/h3&gt;&lt;/span&gt;        The LEDs will move from one end of the strip to the other. It should start off as a RED cylon effect.         As you turn the potentiometer clockwise, the colour of the LEDs will change and move through the various colours of the rainbow.         If the potentiometer reading gets back to zero (fully anti-clockwise), it will move to sequence 2.&lt;br&gt; &amp;nbsp;         &lt;br&gt;        &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Sequence 2: Cylon with brightness control&lt;/h3&gt;&lt;/span&gt;        You will see that the LEDs have turned off. The potentiometer readings correlate with the LED brightness.         At the start of this sequence, the potentiometer readings will be zero, therefore the brightness will be zero (LEDs turned off).         As you turn the potentiometer clockwise, the readings increase, and so will the brightness of the LEDs. &lt;br&gt; &amp;nbsp;         &lt;br&gt;        &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Sequence 3: Comet effect with Hue and direction control&lt;/h3&gt;&lt;/span&gt;        This is where the real fun begins. You control the hue of the leading LED with the potentiometer, however the LED will move         along the LED strip as though it were affected by gravity. As it hits the end of the LED strip, it will bounce for a while         and eventually come to a stop. The more you tilt the accelerometer, the greater the acceleration of the leading LED.         The trailing LEDs have an interesting randomised glow, which creates the &quot;comet&quot; effect.&lt;br&gt; &amp;nbsp;         &lt;br&gt;        &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Sequence 4: FireStarter / Rainbow effect : Hue and direction control&lt;/h3&gt;&lt;/span&gt;        The initial colours of LEDs in this sequence creates a fire-like animation. As the leading LED moves along the LED strip, it appears         to ignite the LEDs in its path, leaving a fire trail behind it. The fire effect is best when you turn the potentiometer clockwise slightly         to introduce a small amount of yellow into the mix of colours.  As you turn the potentiometer further clockwise, the fire trail         turns into a pretty rainbow trail. The accelerometer affects the leading LED in the same way as the previous sequence. &lt;br&gt; &amp;nbsp;         &lt;br&gt;        &lt;span style=&quot;color: #7FD4FF;&quot;&gt;&lt;h3&gt;Sequence 5: Digital spirit level&lt;/h3&gt;&lt;/span&gt;        This sequence was my original idea for this project, however I thought it would be nice to share some of the other cool effects I created on         my journey of discovery. The idea was to make a digital version of a spirit level. I originally wanted the LEDs to represent a spirit level         bubble that would &quot;float&quot; according to the vertical/horizontal position of the LED strip.  However,         as I played around with this sketch, I discovered that it could potentially be used to measure the angle of the strip relative to the horizon.         The angle can be determined by the illuminated LED. If the strip is horizontal, the illuminated LEDs will be close to the middle of the strip, and         their colour will be green. If the strip is vertical, the illuminated LEDs will be close to end of the strip, and their colour will be red.         The colour is just an additional visual indicator. &lt;br&gt; &amp;nbsp;  &lt;/P&gt; &lt;/P&gt;&lt;/div&gt;&lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;P&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;  &lt;h3&gt;&lt;span style=&quot;color: #7FD4FF;&quot;&gt;Concluding Comments&lt;/span&gt;&lt;/h3&gt;  The NeoPixel Digital RGB LED strip is a lot of fun. The FastLED library makes for easy programming,   and allows you to get up and running really quickly. 144 LEDs on a single strip means you have plenty of room for   creative algorithms and lighting effects. Add a few sensors, and &quot;pretty&quot; quickly turns into &quot;awesome&quot; !!&lt;br&gt; &amp;nbsp;   &lt;br&gt;  This tutorial shows you how to control a &lt;a href=&quot;http://openlab.com.au/shop/neopixel-digital-rgb-led-strip-144-led/&quot;&gt;&quot;144 NeoPixel per metre Digital RGB LED strip&quot;&lt;/a&gt; with an Arduino UNO.   Feel free to share your own LED creations in the comments below.&lt;br&gt; &lt;/div&gt; &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt; &lt;br&gt;&lt;div align=&quot;center&quot;&gt;This project would not have been possible without the collaborative effort from &lt;a href=&quot;http://openlab.com.au/&quot;&gt;OpenLab&lt;/a&gt;.&lt;br&gt; Please visit their site for more cool projects.&lt;/div&gt;  &lt;br&gt; &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/1474454661102791211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/07/neopixel-playground.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/1474454661102791211'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/1474454661102791211'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/07/neopixel-playground.html' title='NeoPixel Playground'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/POV-qvEx1ws/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-7675307780405026493</id><published>2015-06-22T13:52:00.000+07:00</published><updated>2018-03-28T22:35:14.867+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="brightness"/><category scheme="http://www.blogger.com/atom/ns#" term="communication"/><category scheme="http://www.blogger.com/atom/ns#" term="computer"/><category scheme="http://www.blogger.com/atom/ns#" term="Hex"/><category scheme="http://www.blogger.com/atom/ns#" term="hexadecimal"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Mouse"/><category scheme="http://www.blogger.com/atom/ns#" term="Processing"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="PWM"/><category scheme="http://www.blogger.com/atom/ns#" term="receive"/><category scheme="http://www.blogger.com/atom/ns#" term="send"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial"/><title type='text'>Send HEX values to Arduino</title><content type='html'> &lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;img style=&quot;border:2px solid #8C7E6F;&quot; height=&quot;116&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9lXUnLHHZVmFybGqdibd_jOzSPZLi5ip3OjHl2c5IKqK4fKS4GU2H_rZcO4dTR9Och61D3C6NC7OWOSmIBZBM33lhKdLSlYqwcKLhfWAzuJ-tm_EonKc_aVACixC4an1r6Kep8JKKvTw/s640/Hex_TitleBar.jpg&quot; width=&quot;650&quot; /&gt;    &lt;/div&gt;    &lt;/P&gt;    &lt;div align=&quot;right&quot;&gt;        &lt;g:plusone&gt;&lt;/g:plusone&gt;    &lt;/div&gt;  &lt;P&gt;  &lt;div&gt;   &lt;P&gt;    &lt;h4&gt;FIVE MINUTE TUTORIAL&lt;/h4&gt;                &lt;h3&gt;&lt;span style=&quot;color: #62AEB2&quot;&gt;Project Description: Sending Hex values to an Arduino UNO&lt;/span&gt;&lt;/h3&gt; &lt;br&gt;                This simple tutorial will show you how to send Hexadecimal values from a computer to an Arduino Uno.     The &quot;Processing&quot; programming language will be used to send the HEX values from the computer when a mouse button is pressed. The Arduino     will use these values to adjust the brightness of an LED.    &lt;/P&gt;   &lt;br&gt;   &lt;P&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;                    &lt;img style=&quot;border:2px solid #8C7E6F;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil9381hyphenhyphenK-ypkS0PhvYS2UoZLJHV4zY6pLWegnpj1dq2YMCrawMEZ1Sp-w6qKYIRzyQbTYfM2eHA4_4G4grpUDvkJvWw24qbYlYUFMBOj_ZvF_g49QoTGpn2tQVL56UlwrW7e2X8Mgs7M/s640/Hexapod+Diagram1.jpg&quot; /&gt;                &lt;/div&gt;            &lt;/P&gt;            &lt;br&gt;&amp;nbsp;             &lt;br&gt;   &lt;P&gt;&lt;h4&gt;Learning Objectives&lt;/h4&gt; &lt;br&gt;   &lt;ul&gt;                &lt;li&gt;To Send Hexadecimal (Hex) values from a computer to the Arduino&lt;/li&gt;                &lt;li&gt;Trigger an action based on the press of a mouse button&lt;/li&gt;                &lt;li&gt;Learn to create a simple Computer to Arduino interface&lt;/li&gt;                &lt;li&gt;Use Arduino&#39;s PWM capabilities to adjust brightness of an LED &lt;/li&gt;                &lt;li&gt;Learn to use Arduino&#39;s analogWrite() function&lt;/li&gt;                &lt;li&gt;Create a simple LED circuit&lt;/li&gt;            &lt;/ul&gt;               &lt;/P&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Parts Required:&lt;/H4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;Arduino Uno or compatible board&lt;/li&gt;    &lt;li&gt;LED&lt;/li&gt;    &lt;li&gt;Breadboard&lt;/li&gt;    &lt;li&gt;330 Ohm Resistor&lt;/li&gt;    &lt;li&gt;Computer - with &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE&lt;/a&gt; and &lt;a href=&quot;https://processing.org/download/?processing&quot;&gt;Processing IDE&lt;/a&gt; installed&lt;/li&gt;    &lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt; &lt;br&gt;  &lt;P&gt;  &lt;H4&gt;Fritzing Sketch&lt;/H4&gt; &lt;br&gt;   The diagram below will show you how to connect an LED to Digital Pin 10 on the Arduino. &lt;br&gt;         Don&#39;t forget the 330 ohm resistor !   &lt;BR /&gt;&amp;nbsp;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLrQLjMhpJHb9h7bq5gkI-i3iMwZp_hfdPyL3qBt5lJ-vClezJifWg-nSvlPpTQuJG74SzMC1OzzbkUUkjAppW1YmIwIFpxopIlbYXUB7smP1pK6D4sxqdr74E9eFXLh8noiIm2UdHwpk/s1600/Simple+LED+Circuit.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:2px solid #8C7E6F;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLrQLjMhpJHb9h7bq5gkI-i3iMwZp_hfdPyL3qBt5lJ-vClezJifWg-nSvlPpTQuJG74SzMC1OzzbkUUkjAppW1YmIwIFpxopIlbYXUB7smP1pK6D4sxqdr74E9eFXLh8noiIm2UdHwpk/s640/Simple+LED+Circuit.jpg&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Arduino Sketch&lt;/H4&gt;  &lt;BR /&gt;  The latest version of Arduino IDE can be downloaded &lt;a href=&quot;http://www.arduino.cc/en/Main/Software&quot;&gt;here. &lt;/a&gt;  &lt;br&gt;  &amp;nbsp;   &lt;br&gt;  &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt;  1&lt;br /&gt;  2&lt;br /&gt;  3&lt;br /&gt;  4&lt;br /&gt;  5&lt;br /&gt;  6&lt;br /&gt;  7&lt;br /&gt;  8&lt;br /&gt;  9&lt;br /&gt; 10&lt;br /&gt; 11&lt;br /&gt; 12&lt;br /&gt; 13&lt;br /&gt; 14&lt;br /&gt; 15&lt;br /&gt; 16&lt;br /&gt; 17&lt;br /&gt; 18&lt;br /&gt; 19&lt;br /&gt; 20&lt;br /&gt; 21&lt;br /&gt; 22&lt;br /&gt; 23&lt;br /&gt; 24&lt;br /&gt; 25&lt;br /&gt; 26&lt;br /&gt; 27&lt;br /&gt; 28&lt;br /&gt; 29&lt;br /&gt; 30&lt;br /&gt; 31&lt;br /&gt;    &lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;    &lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;/*&amp;nbsp;==================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;5&amp;nbsp;min&amp;nbsp;tutorial:&amp;nbsp;Send&amp;nbsp;Hex&amp;nbsp;from&amp;nbsp;computer&amp;nbsp;to&amp;nbsp;Arduino&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;21th&amp;nbsp;June&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Arduino&amp;nbsp;IDE:&amp;nbsp;1.6.4&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;Arduino&amp;nbsp;Sketch&amp;nbsp;used&amp;nbsp;to&amp;nbsp;adjust&amp;nbsp;the&amp;nbsp;brightness&amp;nbsp;of&amp;nbsp;an&amp;nbsp;LED&amp;nbsp;based&amp;nbsp;on&amp;nbsp;the&amp;nbsp;values&amp;nbsp;received&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on&amp;nbsp;the&amp;nbsp;serial&amp;nbsp;port.&amp;nbsp;The&amp;nbsp;LED&amp;nbsp;needs&amp;nbsp;to&amp;nbsp;be&amp;nbsp;connected&amp;nbsp;to&amp;nbsp;a&amp;nbsp;PWM&amp;nbsp;pin.&amp;nbsp;In&amp;nbsp;this&amp;nbsp;sketch&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Pin&amp;nbsp;10&amp;nbsp;is&amp;nbsp;used,&amp;nbsp;however&amp;nbsp;you&amp;nbsp;could&amp;nbsp;use&amp;nbsp;Pin&amp;nbsp;3,&amp;nbsp;5,&amp;nbsp;6,&amp;nbsp;9,&amp;nbsp;or&amp;nbsp;11&amp;nbsp;-&amp;nbsp;if&amp;nbsp;you&amp;nbsp;are&amp;nbsp;using&amp;nbsp;an&amp;nbsp;Arduino&amp;nbsp;Uno.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #434F54;&quot;&gt;=====================================================================================================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;byte&lt;/span&gt; byteRead;                   &lt;span style=&quot;color: #434F54;&quot;&gt;//Variable used to store the byte received on the Serial Port&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;int&lt;/span&gt; ledPin = 10;                 &lt;span style=&quot;color: #434F54;&quot;&gt;//LED is connected to Arduino Pin 10. This pin must be PWM capable.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #5E6D03;&quot;&gt;setup&lt;/span&gt;() {&lt;br /&gt;&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #D35400;&quot;&gt;begin&lt;/span&gt;(9600);             &lt;span style=&quot;color: #434F54;&quot;&gt;//Initialise Serial communication with the computer&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;pinMode&lt;/span&gt;(ledPin, &lt;span style=&quot;color: #00979C;&quot;&gt;OUTPUT&lt;/span&gt;);        &lt;span style=&quot;color: #434F54;&quot;&gt;//Set Pin 10 as an Output pin&lt;/span&gt;&lt;br /&gt;&amp;nbsp;byteRead&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #434F54;&quot;&gt;//Initialise the byteRead variable to zero.&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #00979C;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #5E6D03;&quot;&gt;loop&lt;/span&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #5E6D03;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #D35400;&quot;&gt;available&lt;/span&gt;()) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;byteRead&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #D35400;&quot;&gt;read&lt;/span&gt;();     &lt;span style=&quot;color: #434F54;&quot;&gt;//Update the byteRead variable with the Hex value received on the Serial COM port.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #D35400;&quot;&gt;analogWrite&lt;/span&gt;(ledPin, byteRead);  &lt;span style=&quot;color: #434F54;&quot;&gt;//Use PWM to adjust the brightness of the LED. Brightness is determined by the &quot;byteRead&quot; variable.&lt;/span&gt;&lt;br /&gt;}    &lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;  &lt;P&gt;  &lt;!-- Arduino Code Discussion --&gt; &lt;P&gt; &lt;p&gt;    &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Processing Sketch&lt;/H4&gt;  &lt;BR /&gt;  The latest version of the Processing IDE can be downloaded &lt;a href=&quot;https://processing.org/download/?processing&quot;&gt;here. &lt;/a&gt;  &lt;br&gt;  &amp;nbsp;   &lt;br&gt;  &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid #A2AFBA; border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: #A2AFBA; width: 1.9em&quot;&gt;  1&lt;br /&gt;  2&lt;br /&gt;  3&lt;br /&gt;  4&lt;br /&gt;  5&lt;br /&gt;  6&lt;br /&gt;  7&lt;br /&gt;  8&lt;br /&gt;  9&lt;br /&gt; 10&lt;br /&gt; 11&lt;br /&gt; 12&lt;br /&gt; 13&lt;br /&gt; 14&lt;br /&gt; 15&lt;br /&gt; 16&lt;br /&gt; 17&lt;br /&gt; 18&lt;br /&gt; 19&lt;br /&gt; 20&lt;br /&gt; 21&lt;br /&gt; 22&lt;br /&gt; 23&lt;br /&gt; 24&lt;br /&gt; 25&lt;br /&gt; 26&lt;br /&gt; 27&lt;br /&gt; 28&lt;br /&gt; 29&lt;br /&gt; 30&lt;br /&gt; 31&lt;br /&gt; 32&lt;br /&gt; 33&lt;br /&gt; 34&lt;br /&gt; 35&lt;br /&gt; 36&lt;br /&gt; 37&lt;br /&gt; 38&lt;br /&gt; 39&lt;br /&gt; 40&lt;br /&gt; 41&lt;br /&gt; 42&lt;br /&gt; 43&lt;br /&gt;    &lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;    &lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;/*&amp;nbsp;==================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;5&amp;nbsp;min&amp;nbsp;tutorial:&amp;nbsp;Send&amp;nbsp;Hex&amp;nbsp;from&amp;nbsp;computer&amp;nbsp;to&amp;nbsp;Arduino&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;21th&amp;nbsp;June&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;Processing&amp;nbsp;IDE:&amp;nbsp;2.2.1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;Processing&amp;nbsp;Sketch&amp;nbsp;used&amp;nbsp;to&amp;nbsp;send&amp;nbsp;HEX&amp;nbsp;values&amp;nbsp;from&amp;nbsp;computer&amp;nbsp;to&amp;nbsp;Arduino&amp;nbsp;when&amp;nbsp;the&amp;nbsp;mouse&amp;nbsp;is&amp;nbsp;pressed.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;alternating&amp;nbsp;values&amp;nbsp;0xFF&amp;nbsp;and&amp;nbsp;0x00&amp;nbsp;are&amp;nbsp;sent&amp;nbsp;to&amp;nbsp;the&amp;nbsp;Arduino&amp;nbsp;Uno&amp;nbsp;to&amp;nbsp;turn&amp;nbsp;an&amp;nbsp;LED&amp;nbsp;on&amp;nbsp;and&amp;nbsp;off.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You&amp;nbsp;can&amp;nbsp;send&amp;nbsp;any&amp;nbsp;HEX&amp;nbsp;value&amp;nbsp;from&amp;nbsp;0x00&amp;nbsp;to&amp;nbsp;0xFF.&amp;nbsp;This&amp;nbsp;sketch&amp;nbsp;also&amp;nbsp;shows&amp;nbsp;how&amp;nbsp;to&amp;nbsp;convert&amp;nbsp;Hex&amp;nbsp;strings&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;to&amp;nbsp;Hex&amp;nbsp;numbers.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;=====================================================================================================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;import&lt;/span&gt; processing.serial.*;           &lt;span style=&quot;color: #666666;&quot;&gt;//This import statement is required for  Serial communication&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Serial&amp;nbsp;comPort;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//comPort is used to write Hex values to the Arduino&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;boolean&lt;/span&gt; toggle = &lt;span style=&quot;color: #33997E;&quot;&gt;false&lt;/span&gt;;               &lt;span style=&quot;color: #666666;&quot;&gt;//toggle variable is used to control which hex variable to send  &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;String&lt;/span&gt; zeroHex = &lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;quot;00&amp;quot;&lt;/span&gt;;                &lt;span style=&quot;color: #666666;&quot;&gt;//This &amp;quot;00&amp;quot; string will be converted to 0x00 and sent to Arduino to turn LED off.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;String&lt;/span&gt; FFHex = &lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;quot;FF&amp;quot;&lt;/span&gt;;                  &lt;span style=&quot;color: #666666;&quot;&gt;//This &amp;quot;FF&amp;quot; string will be converted to 0xFF and sent to Arduino to turn LED on.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;&lt;b&gt;setup&lt;/b&gt;&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;comPort&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;new&lt;/span&gt; Serial(&lt;span style=&quot;color: #33997E;&quot;&gt;this&lt;/span&gt;, Serial.&lt;span style=&quot;color: #006699;&quot;&gt;list&lt;/span&gt;()[0], 9600);   &lt;span style=&quot;color: #666666;&quot;&gt;//initialise the COM port for serial communication at a baud rate of 9600.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay(2000);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//this delay allows the com port to initialise properly before initiating any communication.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;background&lt;/span&gt;(0);                    &lt;span style=&quot;color: #666666;&quot;&gt;//Start with a black background.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;&lt;b&gt;draw&lt;/b&gt;&lt;/span&gt;(){                           &lt;span style=&quot;color: #666666;&quot;&gt;//the draw() function is necessary for the sketch to compile &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//do nothing here                  //even though it does nothing.&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;&lt;b&gt;mousePressed&lt;/b&gt;&lt;/span&gt;(){                   &lt;span style=&quot;color: #666666;&quot;&gt;//This function is called when the mouse is pressed within the Processing window.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;toggle&amp;nbsp;=&amp;nbsp;!&amp;nbsp;toggle;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//The toggle variable will change back and forth between &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt;(toggle){                          &lt;span style=&quot;color: #666666;&quot;&gt;//If the toggle variable is TRUE, then send 0xFF to the Arduino&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;comPort.write(&lt;span style=&quot;color: #006699;&quot;&gt;unhex&lt;/span&gt;(FFHex));      &lt;span style=&quot;color: #666666;&quot;&gt;//The unhex() function converts the &amp;quot;FF&amp;quot; string to 0xFF&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;background&lt;/span&gt;(0,0,255);              &lt;span style=&quot;color: #666666;&quot;&gt;//Change the background colour to blue as a visual indication of a button press.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;comPort.write(&lt;span style=&quot;color: #006699;&quot;&gt;unhex&lt;/span&gt;(zeroHex));     &lt;span style=&quot;color: #666666;&quot;&gt;//If the toggle variable is FALSE, then send 0x00 to the Arduino&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;background&lt;/span&gt;(0);                     &lt;span style=&quot;color: #666666;&quot;&gt;//Change the background colour to black as a visual indication of a button press.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;    &lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;  &lt;P&gt;  &lt;!-- Processing Code Discussion --&gt; &lt;P&gt;&lt;/p&gt;   &lt;H4&gt;The Video&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div style=&quot;text-align: center;&quot;&gt;   &lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/-AvB9wP8dFw&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;  &lt;/div&gt; &lt;/P&gt;&lt;/div&gt;&lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;P&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;  The tutorial above is a quick demonstration of how to convert Hex strings on your computer and send them to an Arduino.   The Arduino can use the values to change the brightness of an LED as shown in this tutorial, however you could use it to   modify the speed of a motor, or to pass on commands to another module. Hopefully this short tutorial will help you with your   project. Please let me know how it helped you in the comments below.  &lt;/div&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://arduinobasics.blogspot.com.au/p/arduino-basics-projects-page.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhTPUFHFNR3ehSKck7BOPQuapJ1WmPhY5I1dW28o1WNJFqlH4O7IDu3x2pQ7083d6LDm6fAYVP2C5ljSqf0g4mvOfvfV0ZDjq60HpxMpvPpdV9OrZuuSP3F7nY3UN0QRyXh22Nb4A04fc/s320/ArduinoBasics_OpenLogo+on+Black.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/7675307780405026493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/06/send-hex-values-to-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7675307780405026493'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/7675307780405026493'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/06/send-hex-values-to-arduino.html' title='Send HEX values to Arduino'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9lXUnLHHZVmFybGqdibd_jOzSPZLi5ip3OjHl2c5IKqK4fKS4GU2H_rZcO4dTR9Och61D3C6NC7OWOSmIBZBM33lhKdLSlYqwcKLhfWAzuJ-tm_EonKc_aVACixC4an1r6Kep8JKKvTw/s72-c/Hex_TitleBar.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-8409900028591404562</id><published>2015-05-07T21:07:00.000+07:00</published><updated>2018-03-28T22:35:14.967+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="CH376S"/><category scheme="http://www.blogger.com/atom/ns#" term="communication"/><category scheme="http://www.blogger.com/atom/ns#" term="data"/><category scheme="http://www.blogger.com/atom/ns#" term="IC Station"/><category scheme="http://www.blogger.com/atom/ns#" term="module"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Read"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial Monitor"/><category scheme="http://www.blogger.com/atom/ns#" term="storage"/><category scheme="http://www.blogger.com/atom/ns#" term="UNO"/><category scheme="http://www.blogger.com/atom/ns#" term="USB"/><category scheme="http://www.blogger.com/atom/ns#" term="USB disk"/><category scheme="http://www.blogger.com/atom/ns#" term="USB stick"/><category scheme="http://www.blogger.com/atom/ns#" term="Write"/><title type='text'>CH376S USB Read/Write module</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;    &lt;iframe width=&quot;640&quot; height=&quot;400&quot; src=&quot;https://www.youtube.com/embed/yK3631kMKBU?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;2&quot; allowfullscreen&gt;&lt;/iframe&gt;    &lt;/P&gt; &lt;P&gt;  &lt;div&gt;   &lt;P&gt;    &lt;!-- Description and Introduction of project --&gt;    Have you ever wondered if there was a way to store and retrieve data from a USB stick with an Arduino UNO?     Most people choose SD cards to store their project data, but you may be surprised there IS a way! &lt;br&gt;                IC Station have a nice little module which allows you store and retrieve your Arduino (or other MCU) project data to a USB stick. &lt;br&gt; &amp;nbsp;                 &lt;br&gt;                I am not too sure why USB storage is not widely used in Arduino projects? These modules are not expensive, they have been around for quite a while, and are relatively simple to use.                 You do not need any libraries to get them to work, however, I must say that documentation for this module is not that easy to find.                 This &lt;a href=&quot;http://microembebidos.com/2013/12/15/modulo-extremo-ch376-conversor-usb-fat-file-para-uart-serial/&quot;&gt;site&lt;/a&gt; and this &lt;a href=&quot;http://www.mpja.com/download/ch376ds1.pdf&quot;&gt;document&lt;/a&gt; proved to be very useful in my endevour to get this module working, and I hope my tutorial below will help you get started and bridge some of the information gaps. &lt;br&gt; &amp;nbsp;                 &lt;br&gt;                The &quot;CH376S USB read/write module&quot; has a CH376S chip onboard which does most of the hard work for you.                 All you have to do is send the module some commands from the Arduino and the CH376S chip will do the rest.                 You can communicate with the module in three different ways:                 &lt;ul&gt; &lt;li&gt; Parallel communication &lt;/li&gt;                    &lt;li&gt; SPI communication&lt;/li&gt;                    &lt;li&gt; and Serial (UART) communication.&lt;/li&gt;                &lt;/ul&gt; &lt;br&gt;                 This project will show you the connections and code for the Serial (UART) communication method only.    &lt;/P&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Parts Required:&lt;/H4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=3516&quot;&gt;Arduino UNO or compatible board&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=5271&quot;&gt;CH376S USB Read Write Module&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/826&quot;&gt;Female to Male jumper wires&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.icstation.com/product_info.php?aid=10&amp;products_id=1495&quot;&gt;Breadboard (optional)&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;USB stick&lt;/li&gt;                &lt;li&gt;LED + 330 ohm resistor (optional)&lt;/li&gt;&lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt; &lt;P&gt;  &lt;H4&gt;Remove the Jumper&lt;/H4&gt;  &lt;P&gt;   When the CH376S USB module arrives in it&#39;s package, it will have a jumper between the TXD pin and GND.    You will need to remove this jumper to make the necessary connections between the Arduino UNO    and the CH376S USB module.           &lt;/P&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlKUhunvkx8gDxsYBWFKMj_bXlSo6hv48tH9FWZwXXkxib6C2uOzIKE7rS_9gabV7r9jqYbbG8qmaApr-r_iP8zEV8wqILk2cZZQxtuIcWQk604JYXV5BBmq5QczHYlanheBP8XH8FcqY/s1600/Slide5.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot; width=&quot;640&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlKUhunvkx8gDxsYBWFKMj_bXlSo6hv48tH9FWZwXXkxib6C2uOzIKE7rS_9gabV7r9jqYbbG8qmaApr-r_iP8zEV8wqILk2cZZQxtuIcWQk604JYXV5BBmq5QczHYlanheBP8XH8FcqY/s400/Slide5.JPG&quot; /&gt;            &lt;/a&gt;          &lt;/div&gt;         &lt;BR&gt; &amp;nbsp;    &lt;BR&gt;   &lt;H4&gt;Fritzing Sketch&lt;/H4&gt;         Please note, that the Arduino Sketch makes use of the Arduino UNO&#39;s onboard LED on    digital pin 13. The Fritzing sketch below shows an LED + 300 ohm resistor on a breadboard. This is optional.    The LED is not a necessary component of CH376S module communication.&lt;/P&gt;         &lt;P&gt;   Also be aware that the CH376S USB module has an onboard LED just above the TXD and GND pins near the USB port.    This LED will only turn on providing the CH376S module is in USB mode AND a USB device has been inserted into    the USB port. Both conditions must be met before the module&#39;s onboard LED will illuminate. You will not    see the LED turn on just by powering the board. &lt;br&gt; &amp;nbsp;    &lt;br&gt;   The wire diagram below is the correct setup for Serial communication between an Arduino UNO and the CH376S module.    If you wish to use SPI or Parallel communication, you will need to refer to the datasheet. &lt;/P&gt;  &lt;!-- Fritzing Sketch here --&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj5l3x3EzX5O84ChdTU4ejnX4PooSuVhI_wr5VltIzV-H_DPdSoenGXmmgHNUXMPRxlSFhVE3tdnNFElyDPyDUBFn9nSBZaF4pxxg1dneQ7FZteW2ZpjcEGEEKYpXHv8mec0AvSlsvJQE/s1600/Slide6.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot; width=&quot;640&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj5l3x3EzX5O84ChdTU4ejnX4PooSuVhI_wr5VltIzV-H_DPdSoenGXmmgHNUXMPRxlSFhVE3tdnNFElyDPyDUBFn9nSBZaF4pxxg1dneQ7FZteW2ZpjcEGEEKYpXHv8mec0AvSlsvJQE/s400/Slide6.JPG&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Arduino Sketch&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt;  1&lt;br /&gt;  2&lt;br /&gt;  3&lt;br /&gt;  4&lt;br /&gt;  5&lt;br /&gt;  6&lt;br /&gt;  7&lt;br /&gt;  8&lt;br /&gt;  9&lt;br /&gt; 10&lt;br /&gt; 11&lt;br /&gt; 12&lt;br /&gt; 13&lt;br /&gt; 14&lt;br /&gt; 15&lt;br /&gt; 16&lt;br /&gt; 17&lt;br /&gt; 18&lt;br /&gt; 19&lt;br /&gt; 20&lt;br /&gt; 21&lt;br /&gt; 22&lt;br /&gt; 23&lt;br /&gt; 24&lt;br /&gt; 25&lt;br /&gt; 26&lt;br /&gt; 27&lt;br /&gt; 28&lt;br /&gt; 29&lt;br /&gt; 30&lt;br /&gt; 31&lt;br /&gt; 32&lt;br /&gt; 33&lt;br /&gt; 34&lt;br /&gt; 35&lt;br /&gt; 36&lt;br /&gt; 37&lt;br /&gt; 38&lt;br /&gt; 39&lt;br /&gt; 40&lt;br /&gt; 41&lt;br /&gt; 42&lt;br /&gt; 43&lt;br /&gt; 44&lt;br /&gt; 45&lt;br /&gt; 46&lt;br /&gt; 47&lt;br /&gt; 48&lt;br /&gt; 49&lt;br /&gt; 50&lt;br /&gt; 51&lt;br /&gt; 52&lt;br /&gt; 53&lt;br /&gt; 54&lt;br /&gt; 55&lt;br /&gt; 56&lt;br /&gt; 57&lt;br /&gt; 58&lt;br /&gt; 59&lt;br /&gt; 60&lt;br /&gt; 61&lt;br /&gt; 62&lt;br /&gt; 63&lt;br /&gt; 64&lt;br /&gt; 65&lt;br /&gt; 66&lt;br /&gt; 67&lt;br /&gt; 68&lt;br /&gt; 69&lt;br /&gt; 70&lt;br /&gt; 71&lt;br /&gt; 72&lt;br /&gt; 73&lt;br /&gt; 74&lt;br /&gt; 75&lt;br /&gt; 76&lt;br /&gt; 77&lt;br /&gt; 78&lt;br /&gt; 79&lt;br /&gt; 80&lt;br /&gt; 81&lt;br /&gt; 82&lt;br /&gt; 83&lt;br /&gt; 84&lt;br /&gt; 85&lt;br /&gt; 86&lt;br /&gt; 87&lt;br /&gt; 88&lt;br /&gt; 89&lt;br /&gt; 90&lt;br /&gt; 91&lt;br /&gt; 92&lt;br /&gt; 93&lt;br /&gt; 94&lt;br /&gt; 95&lt;br /&gt; 96&lt;br /&gt; 97&lt;br /&gt; 98&lt;br /&gt; 99&lt;br /&gt;100&lt;br /&gt;101&lt;br /&gt;102&lt;br /&gt;103&lt;br /&gt;104&lt;br /&gt;105&lt;br /&gt;106&lt;br /&gt;107&lt;br /&gt;108&lt;br /&gt;109&lt;br /&gt;110&lt;br /&gt;111&lt;br /&gt;112&lt;br /&gt;113&lt;br /&gt;114&lt;br /&gt;115&lt;br /&gt;116&lt;br /&gt;117&lt;br /&gt;118&lt;br /&gt;119&lt;br /&gt;120&lt;br /&gt;121&lt;br /&gt;122&lt;br /&gt;123&lt;br /&gt;124&lt;br /&gt;125&lt;br /&gt;126&lt;br /&gt;127&lt;br /&gt;128&lt;br /&gt;129&lt;br /&gt;130&lt;br /&gt;131&lt;br /&gt;132&lt;br /&gt;133&lt;br /&gt;134&lt;br /&gt;135&lt;br /&gt;136&lt;br /&gt;137&lt;br /&gt;138&lt;br /&gt;139&lt;br /&gt;140&lt;br /&gt;141&lt;br /&gt;142&lt;br /&gt;143&lt;br /&gt;144&lt;br /&gt;145&lt;br /&gt;146&lt;br /&gt;147&lt;br /&gt;148&lt;br /&gt;149&lt;br /&gt;150&lt;br /&gt;151&lt;br /&gt;152&lt;br /&gt;153&lt;br /&gt;154&lt;br /&gt;155&lt;br /&gt;156&lt;br /&gt;157&lt;br /&gt;158&lt;br /&gt;159&lt;br /&gt;160&lt;br /&gt;161&lt;br /&gt;162&lt;br /&gt;163&lt;br /&gt;164&lt;br /&gt;165&lt;br /&gt;166&lt;br /&gt;167&lt;br /&gt;168&lt;br /&gt;169&lt;br /&gt;170&lt;br /&gt;171&lt;br /&gt;172&lt;br /&gt;173&lt;br /&gt;174&lt;br /&gt;175&lt;br /&gt;176&lt;br /&gt;177&lt;br /&gt;178&lt;br /&gt;179&lt;br /&gt;180&lt;br /&gt;181&lt;br /&gt;182&lt;br /&gt;183&lt;br /&gt;184&lt;br /&gt;185&lt;br /&gt;186&lt;br /&gt;187&lt;br /&gt;188&lt;br /&gt;189&lt;br /&gt;190&lt;br /&gt;191&lt;br /&gt;192&lt;br /&gt;193&lt;br /&gt;194&lt;br /&gt;195&lt;br /&gt;196&lt;br /&gt;197&lt;br /&gt;198&lt;br /&gt;199&lt;br /&gt;200&lt;br /&gt;201&lt;br /&gt;202&lt;br /&gt;203&lt;br /&gt;204&lt;br /&gt;205&lt;br /&gt;206&lt;br /&gt;207&lt;br /&gt;208&lt;br /&gt;209&lt;br /&gt;210&lt;br /&gt;211&lt;br /&gt;212&lt;br /&gt;213&lt;br /&gt;214&lt;br /&gt;215&lt;br /&gt;216&lt;br /&gt;217&lt;br /&gt;218&lt;br /&gt;219&lt;br /&gt;220&lt;br /&gt;221&lt;br /&gt;222&lt;br /&gt;223&lt;br /&gt;224&lt;br /&gt;225&lt;br /&gt;226&lt;br /&gt;227&lt;br /&gt;228&lt;br /&gt;229&lt;br /&gt;230&lt;br /&gt;231&lt;br /&gt;232&lt;br /&gt;233&lt;br /&gt;234&lt;br /&gt;235&lt;br /&gt;236&lt;br /&gt;237&lt;br /&gt;238&lt;br /&gt;239&lt;br /&gt;240&lt;br /&gt;241&lt;br /&gt;242&lt;br /&gt;243&lt;br /&gt;244&lt;br /&gt;245&lt;br /&gt;246&lt;br /&gt;247&lt;br /&gt;248&lt;br /&gt;249&lt;br /&gt;250&lt;br /&gt;251&lt;br /&gt;252&lt;br /&gt;253&lt;br /&gt;254&lt;br /&gt;255&lt;br /&gt;256&lt;br /&gt;257&lt;br /&gt;258&lt;br /&gt;259&lt;br /&gt;260&lt;br /&gt;261&lt;br /&gt;262&lt;br /&gt;263&lt;br /&gt;264&lt;br /&gt;265&lt;br /&gt;266&lt;br /&gt;267&lt;br /&gt;268&lt;br /&gt;269&lt;br /&gt;270&lt;br /&gt;271&lt;br /&gt;272&lt;br /&gt;273&lt;br /&gt;274&lt;br /&gt;275&lt;br /&gt;276&lt;br /&gt;277&lt;br /&gt;278&lt;br /&gt;279&lt;br /&gt;280&lt;br /&gt;281&lt;br /&gt;282&lt;br /&gt;283&lt;br /&gt;284&lt;br /&gt;285&lt;br /&gt;286&lt;br /&gt;287&lt;br /&gt;288&lt;br /&gt;289&lt;br /&gt;290&lt;br /&gt;291&lt;br /&gt;292&lt;br /&gt;293&lt;br /&gt;294&lt;br /&gt;295&lt;br /&gt;296&lt;br /&gt;297&lt;br /&gt;298&lt;br /&gt;299&lt;br /&gt;300&lt;br /&gt;301&lt;br /&gt;302&lt;br /&gt;303&lt;br /&gt;304&lt;br /&gt;305&lt;br /&gt;306&lt;br /&gt;307&lt;br /&gt;308&lt;br /&gt;309&lt;br /&gt;310&lt;br /&gt;311&lt;br /&gt;312&lt;br /&gt;313&lt;br /&gt;314&lt;br /&gt;315&lt;br /&gt;316&lt;br /&gt;317&lt;br /&gt;318&lt;br /&gt;319&lt;br /&gt;320&lt;br /&gt;321&lt;br /&gt;322&lt;br /&gt;323&lt;br /&gt;324&lt;br /&gt;325&lt;br /&gt;326&lt;br /&gt;327&lt;br /&gt;328&lt;br /&gt;329&lt;br /&gt;330&lt;br /&gt;331&lt;br /&gt;332&lt;br /&gt;333&lt;br /&gt;334&lt;br /&gt;335&lt;br /&gt;336&lt;br /&gt;337&lt;br /&gt;338&lt;br /&gt;339&lt;br /&gt;340&lt;br /&gt;341&lt;br /&gt;342&lt;br /&gt;343&lt;br /&gt;344&lt;br /&gt;345&lt;br /&gt;346&lt;br /&gt;347&lt;br /&gt;348&lt;br /&gt;349&lt;br /&gt;350&lt;br /&gt;351&lt;br /&gt;352&lt;br /&gt;353&lt;br /&gt;354&lt;br /&gt;355&lt;br /&gt;356&lt;br /&gt;357&lt;br /&gt;358&lt;br /&gt;359&lt;br /&gt;360&lt;br /&gt;361&lt;br /&gt;362&lt;br /&gt;363&lt;br /&gt;364&lt;br /&gt;365&lt;br /&gt;366&lt;br /&gt;367&lt;br /&gt;368&lt;br /&gt;369&lt;br /&gt;370&lt;br /&gt;371&lt;br /&gt;372&lt;br /&gt;373&lt;br /&gt;374&lt;br /&gt;375&lt;br /&gt;376&lt;br /&gt;377&lt;br /&gt;378&lt;br /&gt;379&lt;br /&gt;380&lt;br /&gt;381&lt;br /&gt;382&lt;br /&gt;383&lt;br /&gt;384&lt;br /&gt;385&lt;br /&gt;386&lt;br /&gt;387&lt;br /&gt;388&lt;br /&gt;389&lt;br /&gt;390&lt;br /&gt;391&lt;br /&gt;392&lt;br /&gt;393&lt;br /&gt;394&lt;br /&gt;395&lt;br /&gt;396&lt;br /&gt;397&lt;br /&gt;398&lt;br /&gt;399&lt;br /&gt;400&lt;br /&gt;401&lt;br /&gt;402&lt;br /&gt;403&lt;br /&gt;404&lt;br /&gt;405&lt;br /&gt;406&lt;br /&gt;407&lt;br /&gt;408&lt;br /&gt;409&lt;br /&gt;410&lt;br /&gt;411&lt;br /&gt;412&lt;br /&gt;413&lt;br /&gt;414&lt;br /&gt;415&lt;br /&gt;416&lt;br /&gt;417&lt;br /&gt;418&lt;br /&gt;419&lt;br /&gt;420&lt;br /&gt;421&lt;br /&gt;422&lt;br /&gt;423&lt;br /&gt;424&lt;br /&gt;425&lt;br /&gt;426&lt;br /&gt;427&lt;br /&gt;428&lt;br /&gt;429&lt;br /&gt;430&lt;br /&gt;431&lt;br /&gt;432&lt;br /&gt;433&lt;br /&gt;434&lt;br /&gt;435&lt;br /&gt;436&lt;br /&gt;437&lt;br /&gt;438&lt;br /&gt;439&lt;br /&gt;440&lt;br /&gt;441&lt;br /&gt;442&lt;br /&gt;443&lt;br /&gt;444&lt;br /&gt;445&lt;br /&gt;446&lt;br /&gt;447&lt;br /&gt;448&lt;br /&gt;449&lt;br /&gt;450&lt;br /&gt;451&lt;br /&gt;452&lt;br /&gt;453&lt;br /&gt;454&lt;br /&gt;455&lt;br /&gt;456&lt;br /&gt;457&lt;br /&gt;458&lt;br /&gt;459&lt;br /&gt;460&lt;br /&gt;461&lt;br /&gt;462&lt;br /&gt;463&lt;br /&gt;464&lt;br /&gt;465&lt;br /&gt;466&lt;br /&gt;467&lt;br /&gt;468&lt;br /&gt;469&lt;br /&gt;470&lt;br /&gt;471&lt;br /&gt;472&lt;br /&gt;473&lt;br /&gt;474&lt;br /&gt;475&lt;br /&gt;476&lt;br /&gt;477&lt;br /&gt;478&lt;br /&gt;479&lt;br /&gt;480&lt;br /&gt;481&lt;br /&gt;482&lt;br /&gt;483&lt;br /&gt;484&lt;br /&gt;485&lt;br /&gt;486&lt;br /&gt;487&lt;br /&gt;488&lt;br /&gt;489&lt;br /&gt;490&lt;br /&gt;491&lt;br /&gt;492&lt;br /&gt;493&lt;br /&gt;494&lt;br /&gt;495&lt;br /&gt;496&lt;br /&gt;497&lt;br /&gt;498&lt;br /&gt;499&lt;br /&gt;500&lt;br /&gt;501&lt;br /&gt;502&lt;br /&gt;503&lt;br /&gt;504&lt;br /&gt;505&lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;    &lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/*&amp;nbsp;===============================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;CH376S USB Read/Write Module testing ground&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;1st&amp;nbsp;May&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Arduino&amp;nbsp;IDE:&amp;nbsp;1.6.2&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;This&amp;nbsp;project&amp;nbsp;will&amp;nbsp;allow&amp;nbsp;you&amp;nbsp;to&amp;nbsp;perform&amp;nbsp;many&amp;nbsp;of&amp;nbsp;the&amp;nbsp;functions&amp;nbsp;available&amp;nbsp;on&amp;nbsp;the&amp;nbsp;CH376S&amp;nbsp;module.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Checking&amp;nbsp;connection&amp;nbsp;to&amp;nbsp;the&amp;nbsp;module,&amp;nbsp;putting&amp;nbsp;the&amp;nbsp;module&amp;nbsp;into&amp;nbsp;USB&amp;nbsp;mode,&amp;nbsp;resetting&amp;nbsp;the&amp;nbsp;module,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;reading,&amp;nbsp;writing,&amp;nbsp;appending&amp;nbsp;text&amp;nbsp;to&amp;nbsp;files&amp;nbsp;on&amp;nbsp;the&amp;nbsp;USB&amp;nbsp;stick.&amp;nbsp;This&amp;nbsp;is&amp;nbsp;very&amp;nbsp;useful&amp;nbsp;alternative&amp;nbsp;to&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SD&amp;nbsp;card&amp;nbsp;modules,&amp;nbsp;plus&amp;nbsp;it&amp;nbsp;doesn&#39;t&amp;nbsp;need&amp;nbsp;any&amp;nbsp;libraries.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;==================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#include&amp;nbsp;&amp;lt;&lt;span style=&quot;color: #CC6600;&quot;&gt;SoftwareSerial&lt;/span&gt;.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; computerByte;           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//used to store data coming from the computer&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; USB_Byte;               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//used to store data coming from the USB stick&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; LED = 13;                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//the LED is connected to digital pin 13 &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; timeOut = 2000;          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//TimeOut is 2 seconds. This is the amount of time you wish to wait for a response from the CH376S module.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; wrData = &lt;span style=&quot;color: #006699;&quot;&gt;&quot;What is the meaning of life ?&quot;&lt;/span&gt;;     &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//We will write this data to a newly created file.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; wrData2 = &lt;span style=&quot;color: #006699;&quot;&gt;&quot;42&quot;&lt;/span&gt;;                                   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//We will append this data to an already existing file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;SoftwareSerial&lt;/span&gt; USB(10, 11);                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Digital pin 10 on Arduino (RX) connects to TXD on the CH376S module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Digital pin 11 on Arduino (TX) connects to RXD on the CH376S module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// GND on Arduino to GND on CH376S module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// 5V on Arduino to 5V on CH376S module&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//==============================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;setup&lt;/b&gt;&lt;/span&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;begin&lt;/span&gt;(9600);                                 &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Setup serial communication with the computer (using a baud rate of 9600 on serial monitor)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;begin&lt;/span&gt;(9600);                                    &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Setup serial communication with the CH376S module (using the default baud rate of 9600)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(LED,&lt;span style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;);                                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Define digital pin 13 as an OUTPUT pin - so that we can use it with an LED&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(LED,&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);                              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Turn off the LED&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//================================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;loop&lt;/b&gt;&lt;/span&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;computerByte&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;();                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//read any incoming bytes from the Serial monitor, and store this byte in the variable called computerByte&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==49){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//1            //If you send the number 1 from the serial monitor, the arduino will read it as digital number 49. Google &quot;ascii table&quot; for more info.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND1: CHECK CONNECTION&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;checkConnection(0x01);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Check for successful connection and communication with the CH376S module.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==50){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//2&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND2: set_USB_Mode&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set_USB_Mode(0x06);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Code used to enable read/write communication and monitoring of the USB stick&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==51){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//3&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND3: resetALL&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetALL();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Reset the USB device&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==52){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//4&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND4: Create and Write to File : TEST4.TXT&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;writeFile(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;TEST4.TXT&quot;&lt;/span&gt;, wrData);                  &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Create a file called TEST4.TXT and then Write the contents of wrData to this file&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==53){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//5&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND5: Read File: TEST4.TXT&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;readFile(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;TEST4.TXT&quot;&lt;/span&gt;);                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Read the contents of this file on the USB disk, and display contents in the Serial Monitor&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==54){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//6&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND6: Append data to file: TEST4.TXT&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;appendFile(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;TEST4.TXT&quot;&lt;/span&gt;, wrData2);                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Append data to the end of the file.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==55){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//7&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND7: Delete File: TEST4.TXT&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileDelete(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;TEST4.TXT&quot;&lt;/span&gt;);                         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Delete the file named TEST4.TXT&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==56){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//8&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND8: Read File: TEST2.TXT&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;readFile(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;TEST2.TXT&quot;&lt;/span&gt;);                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Read the contents of the TEST2.TXT file on the USB disk, and display contents in the Serial Monitor&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(computerByte==57){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//9&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;printCommandHeader(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;COMMAND9: Read File: TEST3.TXT&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;readFile(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;TEST3.TXT&quot;&lt;/span&gt;);                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Read the contents of the TEST3.TXT file on the USB disk, and display contents in the Serial Monitor&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){                                 &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This is here to capture any unexpected data transmitted by the CH376S module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;CH376S has just sent this code:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(), &lt;span style=&quot;color: #006699;&quot;&gt;HEX&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//END&amp;nbsp;OF&amp;nbsp;LOOP&amp;nbsp;FUNCTION&amp;nbsp;========================================================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//print&amp;nbsp;Command&amp;nbsp;header&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; printCommandHeader(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; header){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;======================&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(header);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;----------------------&quot;&lt;/span&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//checkConnection==================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This&amp;nbsp;function&amp;nbsp;is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;check&amp;nbsp;for&amp;nbsp;successful&amp;nbsp;communication&amp;nbsp;with&amp;nbsp;the&amp;nbsp;CH376S&amp;nbsp;module.&amp;nbsp;This&amp;nbsp;is&amp;nbsp;not&amp;nbsp;dependant&amp;nbsp;of&amp;nbsp;the&amp;nbsp;presence&amp;nbsp;of&amp;nbsp;a&amp;nbsp;USB&amp;nbsp;stick.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Send&amp;nbsp;any&amp;nbsp;value&amp;nbsp;between&amp;nbsp;0&amp;nbsp;to&amp;nbsp;255,&amp;nbsp;and&amp;nbsp;the&amp;nbsp;CH376S&amp;nbsp;module&amp;nbsp;will&amp;nbsp;return&amp;nbsp;a&amp;nbsp;number&amp;nbsp;=&amp;nbsp;255&amp;nbsp;-&amp;nbsp;value.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; checkConnection(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; value){&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x06);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;checking connection&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If CH376S responds, it will be true. If it times out, it will be false.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==(255-value)){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;Connection to CH376S was successful.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;blinkLED();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//blink the LED for 1 second if the connection was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;Connection to CH376S - FAILED.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//set_USB_Mode=====================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Make&amp;nbsp;sure&amp;nbsp;that&amp;nbsp;the&amp;nbsp;USB&amp;nbsp;is&amp;nbsp;inserted&amp;nbsp;when&amp;nbsp;using&amp;nbsp;0x06&amp;nbsp;as&amp;nbsp;the&amp;nbsp;value&amp;nbsp;in&amp;nbsp;this&amp;nbsp;specific&amp;nbsp;code&amp;nbsp;sequence&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; set_USB_Mode (&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; value){&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x15);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(20);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB_Byte=USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Check to see if the command has been successfully transmitted and acknowledged.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB_Byte==0x51){                                   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// If true - the CH376S has acknowledged the command.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;set_USB_Mode command acknowledged&quot;&lt;/span&gt;); &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//The CH376S will now check and monitor the USB port&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB_Byte&amp;nbsp;=&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Check to see if the USB stick is connected or not.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB_Byte==0x15){                               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// If true - there is a USB stick connected&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;USB is present&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;blinkLED();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// If the process was successful, then turn the LED on for 1 second &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;USB Not present. Error code:&quot;&lt;/span&gt;);   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// If the USB is not connected - it should return an Error code = FFH&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(USB_Byte, &lt;span style=&quot;color: #006699;&quot;&gt;HEX&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;H&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;CH3765 error!   Error code:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(USB_Byte, &lt;span style=&quot;color: #006699;&quot;&gt;HEX&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;H&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(20);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//resetALL=========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This&amp;nbsp;will&amp;nbsp;perform&amp;nbsp;a&amp;nbsp;hardware&amp;nbsp;reset&amp;nbsp;of&amp;nbsp;the&amp;nbsp;CH376S&amp;nbsp;module&amp;nbsp;-&amp;nbsp;which&amp;nbsp;usually&amp;nbsp;takes&amp;nbsp;about&amp;nbsp;35&amp;nbsp;msecs&amp;nbsp;=====&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; resetALL(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x05);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;The CH376S module has been reset !&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(200);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//readFile=====================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This&amp;nbsp;will&amp;nbsp;send&amp;nbsp;a&amp;nbsp;series&amp;nbsp;of&amp;nbsp;commands&amp;nbsp;to&amp;nbsp;read&amp;nbsp;data&amp;nbsp;from&amp;nbsp;a&amp;nbsp;specific&amp;nbsp;file&amp;nbsp;(defined&amp;nbsp;by&amp;nbsp;fileName)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; readFile(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; fileName){&lt;br /&gt;&amp;nbsp;&amp;nbsp;resetALL();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Reset the module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;set_USB_Mode(0x06);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set to USB Mode&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;diskConnectionStatus();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Check that communication with the USB device is possible&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USBdiskMount();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Prepare the USB for reading/writing - you need to mount the USB disk for proper read/write operations.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;setFileName(fileName);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set File name&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;fileOpen();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Open the file for reading&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; fs = getFileSize();         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Get the size of the file&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;fileRead();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//***** Send the command to read the file ***&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;fileClose(0x00);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Close the file&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//writeFile========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;create&amp;nbsp;a&amp;nbsp;new&amp;nbsp;file&amp;nbsp;and&amp;nbsp;then&amp;nbsp;write&amp;nbsp;data&amp;nbsp;to&amp;nbsp;that&amp;nbsp;file.&amp;nbsp;&quot;fileName&quot;&amp;nbsp;is&amp;nbsp;a&amp;nbsp;variable&amp;nbsp;used&amp;nbsp;to&amp;nbsp;hold&amp;nbsp;the&amp;nbsp;name&amp;nbsp;of&amp;nbsp;the&amp;nbsp;file&amp;nbsp;(e.g&amp;nbsp;TEST.TXT).&amp;nbsp;&quot;data&quot;&amp;nbsp;should&amp;nbsp;not&amp;nbsp;be&amp;nbsp;greater&amp;nbsp;than&amp;nbsp;255&amp;nbsp;bytes&amp;nbsp;long.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; writeFile(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; fileName, &lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; data){&lt;br /&gt;&amp;nbsp;&amp;nbsp;resetALL();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Reset the module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;set_USB_Mode(0x06);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set to USB Mode&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;diskConnectionStatus();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Check that communication with the USB device is possible&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USBdiskMount();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Prepare the USB for reading/writing - you need to mount the USB disk for proper read/write operations.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;setFileName(fileName);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set File name&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(fileCreate()){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Try to create a new file. If file creation is successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileWrite(data);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//write data to the file.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;File could not be created, or it already exists&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;fileClose(0x01);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//appendFile()====================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;write&amp;nbsp;data&amp;nbsp;to&amp;nbsp;the&amp;nbsp;end&amp;nbsp;of&amp;nbsp;the&amp;nbsp;file,&amp;nbsp;without&amp;nbsp;erasing&amp;nbsp;the&amp;nbsp;contents&amp;nbsp;of&amp;nbsp;the&amp;nbsp;file.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; appendFile(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; fileName, &lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; data){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resetALL();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Reset the module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set_USB_Mode(0x06);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set to USB Mode&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;diskConnectionStatus();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Check that communication with the USB device is possible&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USBdiskMount();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Prepare the USB for reading/writing - you need to mount the USB disk for proper read/write operations.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setFileName(fileName);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set File name&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileOpen();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Open the file&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filePointer(&lt;span style=&quot;color: #CC6600;&quot;&gt;false&lt;/span&gt;);             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//filePointer(false) is to set the pointer at the end of the file.  filePointer(true) will set the pointer to the beginning.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileWrite(data);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Write data to the end of the file&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileClose(0x01);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Close the file using 0x01 - which means to update the size of the file on close. &lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//setFileName======================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This&amp;nbsp;sets&amp;nbsp;the&amp;nbsp;name&amp;nbsp;of&amp;nbsp;the&amp;nbsp;file&amp;nbsp;to&amp;nbsp;work&amp;nbsp;with&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; setFileName(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; fileName){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Setting filename to:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(fileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x2F);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x2F);         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Every filename must have this byte to indicate the start of the file name.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(fileName);     &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// &quot;fileName&quot; is a variable that holds the name of the file.  eg. TEST.TXT&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0x00);   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// you need to cast as a byte - otherwise it will not compile.  The null byte indicates the end of the file name.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(20);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//diskConnectionStatus================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Check&amp;nbsp;the&amp;nbsp;disk&amp;nbsp;connection&amp;nbsp;status&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; diskConnectionStatus(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Checking USB disk connection status&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x30);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Connecting to USB disk&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If CH376S responds, it will be true. If it times out, it will be false.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x14){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//CH376S will send 0x14 if this command was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;Connection to USB OK&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;Connection to USB - FAILED.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//USBdiskMount========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//initialise&amp;nbsp;the&amp;nbsp;USB&amp;nbsp;disk&amp;nbsp;and&amp;nbsp;check&amp;nbsp;that&amp;nbsp;it&amp;nbsp;is&amp;nbsp;ready&amp;nbsp;-&amp;nbsp;this&amp;nbsp;process&amp;nbsp;is&amp;nbsp;required&amp;nbsp;if&amp;nbsp;you&amp;nbsp;want&amp;nbsp;to&amp;nbsp;find&amp;nbsp;the&amp;nbsp;manufacturing&amp;nbsp;information&amp;nbsp;of&amp;nbsp;the&amp;nbsp;USB&amp;nbsp;disk&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; USBdiskMount(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Mounting USB disk&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x31);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;mounting USB disk&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If CH376S responds, it will be true. If it times out, it will be false.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x14){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//CH376S will send 0x14 if this command was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;USB Mounted - OK&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;Failed to Mount USB disk.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//fileOpen========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//opens&amp;nbsp;the&amp;nbsp;file&amp;nbsp;for&amp;nbsp;reading&amp;nbsp;or&amp;nbsp;writing&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; fileOpen(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Opening file.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x32);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;file Open&quot;&lt;/span&gt;)){                 &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If CH376S responds, it will be true. If it times out, it will be false.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x14){                 &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//CH376S will send 0x14 if this command was successful  &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;File opened successfully.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;Failed to open file.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//setByteRead=====================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This&amp;nbsp;function&amp;nbsp;is&amp;nbsp;required&amp;nbsp;if&amp;nbsp;you&amp;nbsp;want&amp;nbsp;to&amp;nbsp;read&amp;nbsp;data&amp;nbsp;from&amp;nbsp;the&amp;nbsp;file.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; setByteRead(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; numBytes){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; bytesToRead=&lt;span style=&quot;color: #CC6600;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; timeCounter = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x3A);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)numBytes);   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//tells the CH376S how many bytes to read at a time&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0x00);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;setByteRead&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If CH376S responds, it will be true. If it times out, it will be false.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x1D){         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//read the CH376S message. If equal to 0x1D, data is present, so return true. Will return 0x14 if no data is present.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bytesToRead=&lt;span style=&quot;color: #CC6600;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(bytesToRead);&lt;br /&gt;}&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//getFileSize()===================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//writes&amp;nbsp;the&amp;nbsp;file&amp;nbsp;size&amp;nbsp;to&amp;nbsp;the&amp;nbsp;serial&amp;nbsp;Monitor.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; getFileSize(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; fileSize=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Getting File Size&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x0C);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x68);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(100);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;FileSize =&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileSize&amp;nbsp;=&amp;nbsp;fileSize&amp;nbsp;+&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileSize&amp;nbsp;=&amp;nbsp;fileSize&amp;nbsp;+&amp;nbsp;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;()*255);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileSize&amp;nbsp;=&amp;nbsp;fileSize&amp;nbsp;+&amp;nbsp;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;()*255*255);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileSize&amp;nbsp;=&amp;nbsp;fileSize&amp;nbsp;+&amp;nbsp;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;()*255*255*255);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(fileSize);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(10);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(fileSize);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//fileRead========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//read&amp;nbsp;the&amp;nbsp;contents&amp;nbsp;of&amp;nbsp;the&amp;nbsp;file&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; fileRead(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Reading file:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; firstByte = 0x00;                     &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Variable to hold the firstByte from every transmission.  Can be used as a checkSum if required.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; numBytes = 0x40;                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//The maximum value is 0x40  =  64 bytes&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;while&lt;/span&gt;(setByteRead(numBytes)){              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This tells the CH376S module how many bytes to read on the next reading step. In this example, we will read 0x10 bytes at a time. Returns true if there are bytes to read, false if there are no more bytes to read.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x27);                          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Command to read ALL of the bytes (allocated by setByteRead(x))&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;reading data&quot;&lt;/span&gt;)){      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Wait for the CH376S module to return data. TimeOut will return false. If data is being transmitted, it will return true.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;firstByte=USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;();                 &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Read the first byte&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;while&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;());           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Send the data from the USB disk to the Serial monitor&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(1);                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This delay is necessary for successful Serial transmission&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(!continueRead()){                       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//prepares the module for further reading. If false, stop reading.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;break&lt;/span&gt;;                                   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//You need the continueRead() method if the data to be read from the USB device is greater than numBytes.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;NO MORE DATA&quot;&lt;/span&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//fileWrite=======================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//are&amp;nbsp;the&amp;nbsp;commands&amp;nbsp;used&amp;nbsp;to&amp;nbsp;write&amp;nbsp;to&amp;nbsp;the&amp;nbsp;file&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; fileWrite(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; data){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Writing to file:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; dataLength = (&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;) data.&lt;span style=&quot;color: #CC6600;&quot;&gt;length&lt;/span&gt;();         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This variable holds the length of the data to be written (in bytes)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(data);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Data Length:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(dataLength);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(100);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This set of commands tells the CH376S module how many bytes to expect from the Arduino.  (defined by the &quot;dataLength&quot; variable)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x3C);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;) dataLength);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;) 0x00);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;setting data Length&quot;&lt;/span&gt;)){      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Wait for an acknowledgement from the CH376S module before trying to send data to it&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x1E){                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// 0x1E indicates that the USB device is in write mode.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x2D);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(data);                             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// write the data to the file&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;writing data to file&quot;&lt;/span&gt;)){   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// wait for an acknowledgement from the CH376S module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Write code (normally FF and 14): &quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(),&lt;span style=&quot;color: #006699;&quot;&gt;HEX&lt;/span&gt;);                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// code is normally 0xFF&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;,&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x3D);                             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This is used to update the file size. Not sure if this is necessary for successful writing.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;updating file size&quot;&lt;/span&gt;)){   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// wait for an acknowledgement from the CH376S module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(),&lt;span style=&quot;color: #006699;&quot;&gt;HEX&lt;/span&gt;);              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//code is normally 0x14&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//continueRead()==================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//continue&amp;nbsp;to&amp;nbsp;read&amp;nbsp;the&amp;nbsp;file&amp;nbsp;:&amp;nbsp;I&amp;nbsp;could&amp;nbsp;not&amp;nbsp;get&amp;nbsp;this&amp;nbsp;function&amp;nbsp;to&amp;nbsp;work&amp;nbsp;as&amp;nbsp;intended.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; continueRead(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; readAgain = &lt;span style=&quot;color: #CC6600;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x3B);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;continueRead&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If CH376S responds, it will be true. If it times out, it will be false.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x14){         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//CH376S will send 0x14 if this command was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;readAgain=&lt;span style=&quot;color: #CC6600;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(readAgain);&lt;br /&gt;}&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//fileCreate()========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//the&amp;nbsp;command&amp;nbsp;sequence&amp;nbsp;to&amp;nbsp;create&amp;nbsp;a&amp;nbsp;file&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; fileCreate(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; createdFile = &lt;span style=&quot;color: #CC6600;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x34);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;creating file&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If file has been created successfully, it will return true.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x14){          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//CH376S will send 0x14 if this command was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;createdFile=&lt;span style=&quot;color: #CC6600;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(createdFile);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//fileDelete()========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//the&amp;nbsp;command&amp;nbsp;sequence&amp;nbsp;to&amp;nbsp;delete&amp;nbsp;a&amp;nbsp;file&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; fileDelete(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; fileName){&lt;br /&gt;&amp;nbsp;&amp;nbsp;setFileName(fileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(20);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x35);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;deleting file&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. If file has been created successfully, it will return true.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x14){          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//CH376S will send 0x14 if this command was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Successfully deleted file&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//filePointer========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;file&amp;nbsp;pointer&amp;nbsp;position.&amp;nbsp;true&amp;nbsp;for&amp;nbsp;beginning&amp;nbsp;of&amp;nbsp;file,&amp;nbsp;false&amp;nbsp;for&amp;nbsp;the&amp;nbsp;end&amp;nbsp;of&amp;nbsp;the&amp;nbsp;file.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; filePointer(&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; fileBeginning){&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x39);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(fileBeginning){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0x00);             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//beginning of file&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0x00);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0x00);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0x00);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0xFF);             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//end of file&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0xFF);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0xFF);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)0xFF);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;setting file pointer&quot;&lt;/span&gt;)){       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for a response from the CH376S. &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(getResponseFromUSB()==0x14){                 &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//CH376S will send 0x14 if this command was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Pointer successfully applied&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//fileClose=======================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//closes&amp;nbsp;the&amp;nbsp;file&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; fileClose(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; closeCmd){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Closing file:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x57);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0xAB);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x36);&lt;br /&gt;&amp;nbsp;&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;)closeCmd);                                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// closeCmd = 0x00 = close without updating file Size, 0x01 = close and update file Size&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(waitForResponse(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;closing file&quot;&lt;/span&gt;)){                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// wait for a response from the CH376S. &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; resp = getResponseFromUSB();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(resp==0x14){                                        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// CH376S will send 0x14 if this command was successful&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;File closed successfully.&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;&amp;gt;Failed to close file. Error code:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(resp, &lt;span style=&quot;color: #006699;&quot;&gt;HEX&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//waitForResponse===================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;wait&amp;nbsp;for&amp;nbsp;a&amp;nbsp;response&amp;nbsp;from&amp;nbsp;USB.&amp;nbsp;Returns&amp;nbsp;true&amp;nbsp;when&amp;nbsp;bytes&amp;nbsp;become&amp;nbsp;available,&amp;nbsp;false&amp;nbsp;if&amp;nbsp;it&amp;nbsp;times&amp;nbsp;out.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; waitForResponse(&lt;span style=&quot;color: #CC6600;&quot;&gt;String&lt;/span&gt; errorMsg){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; bytesAvailable = &lt;span style=&quot;color: #CC6600;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; counter=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;while&lt;/span&gt;(!USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){     &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//wait for CH376S to verify command&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;counter++;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(counter&amp;gt;timeOut){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;TimeOut waiting for response: Error while: &quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(errorMsg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bytesAvailable&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(bytesAvailable);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//getResponseFromUSB================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;get&amp;nbsp;any&amp;nbsp;error&amp;nbsp;codes&amp;nbsp;or&amp;nbsp;messages&amp;nbsp;from&amp;nbsp;the&amp;nbsp;CH376S&amp;nbsp;module&amp;nbsp;(in&amp;nbsp;response&amp;nbsp;to&amp;nbsp;certain&amp;nbsp;commands)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; getResponseFromUSB(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; response = &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;(0x00);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt; (USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;response&amp;nbsp;=&amp;nbsp;USB.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(response);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//blinkLED==========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Turn&amp;nbsp;an&amp;nbsp;LED&amp;nbsp;on&amp;nbsp;for&amp;nbsp;1&amp;nbsp;second&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; blinkLED(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(LED, &lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(1000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(LED,&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt; &lt;BR /&gt;  &lt;P&gt;  If you copy and paste this code directly into the Arduino IDE;  you may get a warning like this when you compile the code:&lt;br&gt; &amp;nbsp;   &lt;br&gt;        &amp;nbsp;&amp;nbsp;&amp;nbsp;&quot;Low memory available, stability problems may occur&quot;. &lt;br&gt;&amp;nbsp;         &lt;br&gt;  I managed to run the sketch without any issues, however, I did experience problems with some of the methods when I had   made further memory hungry modifications. If you do encounter problems, I would recommend that you eliminate any   methods which you do not plan to use, and perhaps reduce the number of Serial.print statements throughout the code.   However, please note that some of the methods will not work unless the module is in the correct state, so be careful which methods you delete.   For example, I found that I could get some simple functionality without the &quot;USBdiskMount()&quot; method. However, I could not   read/write data beyond a certain length without this method.&lt;br&gt; &amp;nbsp;         &lt;br&gt;         Also please note, that some of the methods called within the reading and writing sequence   do not need to be called every time. They can be called once in setup, while other methods within the sequence will need to be called every time.   I grouped them all together for simplicity.  &lt;/P&gt; &lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;  &lt;P&gt;&lt;h4&gt;Serial Commands&lt;/h4&gt;  Have a look at the following presentation for a summary of the Serial commands used in this tutorial: &lt;br&gt; &amp;nbsp;   &lt;br&gt;  &lt;div align=&quot;left&quot;&gt;        &lt;iframe src=&quot;https://docs.google.com/presentation/d/1t-jgM9xnAGvfuTMGv3GuY0CxSmXZHLwYTnU_DO3SzwA/embed?start=false&amp;loop=false&amp;delayms=15000&quot; frameborder=&quot;0&quot; width=&quot;640&quot; height=&quot;509&quot; allowfullscreen=&quot;true&quot; mozallowfullscreen=&quot;true&quot; webkitallowfullscreen=&quot;true&quot;&gt;&lt;/iframe&gt;  &lt;/div&gt; &lt;/P&gt; &lt;/div&gt;&lt;P&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;  &lt;!-- Concluding Comments --&gt; &lt;/div&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt; &lt;/P&gt;     &lt;br&gt; &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/8409900028591404562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/05/ch376s-usb-readwrite-module.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/8409900028591404562'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/8409900028591404562'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/05/ch376s-usb-readwrite-module.html' title='CH376S USB Read/Write module'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/yK3631kMKBU/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-4007741960697039807</id><published>2015-04-24T15:32:00.000+07:00</published><updated>2018-03-28T22:35:15.077+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="communication"/><category scheme="http://www.blogger.com/atom/ns#" term="Ear-clip"/><category scheme="http://www.blogger.com/atom/ns#" term="Grove"/><category scheme="http://www.blogger.com/atom/ns#" term="Heart"/><category scheme="http://www.blogger.com/atom/ns#" term="Heart Beat"/><category scheme="http://www.blogger.com/atom/ns#" term="Heart Rate"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="Processing"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Sensor"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial"/><title type='text'>Arduino Heart Rate Monitor</title><content type='html'> &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;        &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;400&quot; src=&quot;https://www.youtube.com/embed/jXKNWb1esoc?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;1&quot; allowfullscreen&gt;&lt;/iframe&gt;        &lt;/div&gt;    &lt;/P&gt;    &lt;br&gt;  &lt;P&gt;  &lt;div&gt;   &lt;P&gt;  &lt;H4&gt;Project Description&lt;/H4&gt;&lt;br&gt;    Heart Rate Monitors are very popular at the moment. &lt;br&gt;                There is something very appealing about watching the pattern of your own heart beat.                 And once you see it, there is an unstoppable urge to try and control it.                 This simple project will allow you to visualize your heart beat, and will calculate                 your heart rate. Keep reading to learn how to create your very own heart rate monitor.    &lt;/P&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Parts Required:&lt;/H4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Freetronics-Eleven-100-Arduino-Uno-Compatible-p/ard-1002.htm&quot;&gt;Arduino UNO or compatible board&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Base-Shield-v1-3-p/sld01099p.htm&quot;&gt;Grove Base Shield&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Ear-clip-Heart-Rate-Sensor-p/med03212p.htm&quot;&gt;Grove Ear-clip Heart Rate Sensor&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Universal-4-Pin-20cm-Cable-5pk-p/acc11317o.htm&quot;&gt;Grove Universal 4 pin cables&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Blue-LED-p/com04051p.htm&quot;&gt;LED and 330 ohm resistor&lt;/a&gt;&lt;/li&gt;                &lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt; &lt;BR /&gt; &lt;P&gt;  &lt;H4&gt;&lt;a href=&quot;http://fritzing.org/download/&quot;&gt;Fritzing Sketch&lt;/a&gt;&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisaMzjrKiPyvuiWs-Ay2X3iH-VvAzkh0KtewADPA9uPZRhxMEhEcVKNQT8Ut0_vDNuyu_9Aq9SzYe0NAe-mBI_hZiSD-NUP8iZwbUH6OkeZf3NduzpKEW4rqVPveG2vwOo87EJlan4fsk/s1600/Slide6.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisaMzjrKiPyvuiWs-Ay2X3iH-VvAzkh0KtewADPA9uPZRhxMEhEcVKNQT8Ut0_vDNuyu_9Aq9SzYe0NAe-mBI_hZiSD-NUP8iZwbUH6OkeZf3NduzpKEW4rqVPveG2vwOo87EJlan4fsk/s1600/Slide6.JPG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;            &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;        &lt;H4&gt;Grove Base Shield to Module Connections&lt;/H4&gt;        &lt;BR /&gt;&amp;nbsp;         &lt;br&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzuDJecrKOmOLlsOIQaXPGZ-BpCkYCvPc_tqlFQ9cV75GFyTxnyEjlqKK8z7A7iYKKFujUfSrYTB3i6MiKgUCUaAXdRVUkvQR0k8NaOGCpmR7M1TIiF9zcuenoJ7TfEN3qf6hjmvCLaUg/s1600/Slide7.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzuDJecrKOmOLlsOIQaXPGZ-BpCkYCvPc_tqlFQ9cV75GFyTxnyEjlqKK8z7A7iYKKFujUfSrYTB3i6MiKgUCUaAXdRVUkvQR0k8NaOGCpmR7M1TIiF9zcuenoJ7TfEN3qf6hjmvCLaUg/s1600/Slide7.JPG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;            &lt;br /&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;&lt;a href=&quot;http://www.arduino.cc/en/main/Software&quot;&gt;Arduino Sketch&lt;/a&gt;&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt;&lt;br /&gt;  1&lt;br /&gt;  2&lt;br /&gt;  3&lt;br /&gt;  4&lt;br /&gt;  5&lt;br /&gt;  6&lt;br /&gt;  7&lt;br /&gt;  8&lt;br /&gt;  9&lt;br /&gt; 10&lt;br /&gt; 11&lt;br /&gt; 12&lt;br /&gt; 13&lt;br /&gt; 14&lt;br /&gt; 15&lt;br /&gt; 16&lt;br /&gt; 17&lt;br /&gt; 18&lt;br /&gt; 19&lt;br /&gt; 20&lt;br /&gt; 21&lt;br /&gt; 22&lt;br /&gt; 23&lt;br /&gt; 24&lt;br /&gt; 25&lt;br /&gt; 26&lt;br /&gt; 27&lt;br /&gt; 28&lt;br /&gt; 29&lt;br /&gt; 30&lt;br /&gt; 31&lt;br /&gt; 32&lt;br /&gt; 33&lt;br /&gt; 34&lt;br /&gt; 35&lt;br /&gt; 36&lt;br /&gt; 37&lt;br /&gt; 38&lt;br /&gt; 39&lt;br /&gt; 40&lt;br /&gt; 41&lt;br /&gt; 42&lt;br /&gt; 43&lt;br /&gt; 44&lt;br /&gt; 45&lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;    &lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/*&amp;nbsp;=================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;Arduino&amp;nbsp;Heart&amp;nbsp;rate&amp;nbsp;monitor&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;21st&amp;nbsp;April&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Arduino&amp;nbsp;IDE:&amp;nbsp;1.6.2&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;This&amp;nbsp;is&amp;nbsp;a&amp;nbsp;simple&amp;nbsp;sketch&amp;nbsp;that&amp;nbsp;uses&amp;nbsp;a&amp;nbsp;Grove&amp;nbsp;Ear-clip&amp;nbsp;Heart&amp;nbsp;Rate&amp;nbsp;sensor&amp;nbsp;attached&amp;nbsp;to&amp;nbsp;an&amp;nbsp;Arduino&amp;nbsp;UNO,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;which&amp;nbsp;sends&amp;nbsp;heart&amp;nbsp;rate&amp;nbsp;data&amp;nbsp;to&amp;nbsp;the&amp;nbsp;computer&amp;nbsp;via&amp;nbsp;Serial&amp;nbsp;communication.&amp;nbsp;You&amp;nbsp;can&amp;nbsp;see&amp;nbsp;the&amp;nbsp;raw&amp;nbsp;data&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&amp;nbsp;the&amp;nbsp;Serial&amp;nbsp;monitor&amp;nbsp;on&amp;nbsp;the&amp;nbsp;Arduino&amp;nbsp;IDE,&amp;nbsp;however,&amp;nbsp;this&amp;nbsp;sketch&amp;nbsp;was&amp;nbsp;specifically&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;designed&amp;nbsp;to&amp;nbsp;interface&amp;nbsp;with&amp;nbsp;the&amp;nbsp;matching&amp;nbsp;Processing&amp;nbsp;sketch&amp;nbsp;for&amp;nbsp;a&amp;nbsp;much&amp;nbsp;nicer&amp;nbsp;graphical&amp;nbsp;display.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NO&amp;nbsp;LIBRARIES&amp;nbsp;REQUIRED.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;===================================================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#define&amp;nbsp;Heart&amp;nbsp;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Attach the Grove Ear-clip sensor to digital pin 2.&lt;/span&gt;&lt;br /&gt;#define&amp;nbsp;LED&amp;nbsp;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Attach an LED to digital pin 4&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;boolean&lt;/span&gt; beat = &lt;span style=&quot;color: #CC6600;&quot;&gt;false&lt;/span&gt;;                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;/* This &quot;beat&quot; variable is used to control the timing of the Serial communication&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;so&amp;nbsp;that&amp;nbsp;data&amp;nbsp;is&amp;nbsp;only&amp;nbsp;sent&amp;nbsp;when&amp;nbsp;there&amp;nbsp;is&amp;nbsp;a&amp;nbsp;&quot;change&quot;&amp;nbsp;in&amp;nbsp;digital&amp;nbsp;readings.&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//==SETUP==========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;setup&lt;/b&gt;&lt;/span&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;begin&lt;/span&gt;(9600);                     &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Initialise serial communication&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(Heart, &lt;span style=&quot;color: #006699;&quot;&gt;INPUT&lt;/span&gt;);                  &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set digital pin 2 (heart rate sensor pin) as an INPUT&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(LED, &lt;span style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;);                   &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Set digital pin 4 (LED) to an OUTPUT&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//==LOOP============================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;loop&lt;/b&gt;&lt;/span&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalRead&lt;/span&gt;(Heart)&amp;gt;0){               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//The heart rate sensor will trigger HIGH when there is a heart beat&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(!beat){                            &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Only send data when it first discovers a heart beat - otherwise it will send a high value multiple times&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;beat=&lt;span style=&quot;color: #CC6600;&quot;&gt;true&lt;/span&gt;;                          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//By changing the beat variable to true, it stops further transmissions of the high signal&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(LED, &lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;);            &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Turn the LED on &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(1023);               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Send the high value to the computer via Serial communication.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {                                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//If the reading is LOW, &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(beat){                             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//and if this has just changed from HIGH to LOW (first low reading)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;beat=&lt;span style=&quot;color: #CC6600;&quot;&gt;false&lt;/span&gt;;                         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//change the beat variable to false (to stop multiple transmissions)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(LED, &lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Turn the LED off.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(0);                  &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//then send a low value to the computer via Serial communication.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt; &amp;nbsp; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;&lt;a href=&quot;https://processing.org/download/?processing&quot;&gt;Processing Sketch&lt;/a&gt;&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(192,192,192);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(192,192,192); width: 1.9em&quot;&gt;  1&lt;br /&gt;  2&lt;br /&gt;  3&lt;br /&gt;  4&lt;br /&gt;  5&lt;br /&gt;  6&lt;br /&gt;  7&lt;br /&gt;  8&lt;br /&gt;  9&lt;br /&gt; 10&lt;br /&gt; 11&lt;br /&gt; 12&lt;br /&gt; 13&lt;br /&gt; 14&lt;br /&gt; 15&lt;br /&gt; 16&lt;br /&gt; 17&lt;br /&gt; 18&lt;br /&gt; 19&lt;br /&gt; 20&lt;br /&gt; 21&lt;br /&gt; 22&lt;br /&gt; 23&lt;br /&gt; 24&lt;br /&gt; 25&lt;br /&gt; 26&lt;br /&gt; 27&lt;br /&gt; 28&lt;br /&gt; 29&lt;br /&gt; 30&lt;br /&gt; 31&lt;br /&gt; 32&lt;br /&gt; 33&lt;br /&gt; 34&lt;br /&gt; 35&lt;br /&gt; 36&lt;br /&gt; 37&lt;br /&gt; 38&lt;br /&gt; 39&lt;br /&gt; 40&lt;br /&gt; 41&lt;br /&gt; 42&lt;br /&gt; 43&lt;br /&gt; 44&lt;br /&gt; 45&lt;br /&gt; 46&lt;br /&gt; 47&lt;br /&gt; 48&lt;br /&gt; 49&lt;br /&gt; 50&lt;br /&gt; 51&lt;br /&gt; 52&lt;br /&gt; 53&lt;br /&gt; 54&lt;br /&gt; 55&lt;br /&gt; 56&lt;br /&gt; 57&lt;br /&gt; 58&lt;br /&gt; 59&lt;br /&gt; 60&lt;br /&gt; 61&lt;br /&gt; 62&lt;br /&gt; 63&lt;br /&gt; 64&lt;br /&gt; 65&lt;br /&gt; 66&lt;br /&gt; 67&lt;br /&gt; 68&lt;br /&gt; 69&lt;br /&gt; 70&lt;br /&gt; 71&lt;br /&gt; 72&lt;br /&gt; 73&lt;br /&gt; 74&lt;br /&gt; 75&lt;br /&gt; 76&lt;br /&gt; 77&lt;br /&gt; 78&lt;br /&gt; 79&lt;br /&gt; 80&lt;br /&gt; 81&lt;br /&gt; 82&lt;br /&gt; 83&lt;br /&gt; 84&lt;br /&gt; 85&lt;br /&gt; 86&lt;br /&gt; 87&lt;br /&gt; 88&lt;br /&gt; 89&lt;br /&gt; 90&lt;br /&gt; 91&lt;br /&gt; 92&lt;br /&gt; 93&lt;br /&gt; 94&lt;br /&gt; 95&lt;br /&gt; 96&lt;br /&gt; 97&lt;br /&gt; 98&lt;br /&gt; 99&lt;br /&gt;100&lt;br /&gt;101&lt;br /&gt;102&lt;br /&gt;103&lt;br /&gt;104&lt;br /&gt;105&lt;br /&gt;106&lt;br /&gt;107&lt;br /&gt;108&lt;br /&gt;109&lt;br /&gt;110&lt;br /&gt;111&lt;br /&gt;112&lt;br /&gt;113&lt;br /&gt;114&lt;br /&gt;115&lt;br /&gt;116&lt;br /&gt;117&lt;br /&gt;118&lt;br /&gt;119&lt;br /&gt;120&lt;br /&gt;121&lt;br /&gt;122&lt;br /&gt;123&lt;br /&gt;124&lt;br /&gt;125&lt;br /&gt;126&lt;br /&gt;127&lt;br /&gt;128&lt;br /&gt;129&lt;br /&gt;130&lt;br /&gt;131&lt;br /&gt;132&lt;br /&gt;133&lt;br /&gt;134&lt;br /&gt;135&lt;br /&gt;136&lt;br /&gt;137&lt;br /&gt;138&lt;br /&gt;139&lt;br /&gt;140&lt;br /&gt;141&lt;br /&gt;142&lt;br /&gt;143&lt;br /&gt;144&lt;br /&gt;145&lt;br /&gt;146&lt;br /&gt;147&lt;br /&gt;148&lt;br /&gt;149&lt;br /&gt;150&lt;br /&gt;151&lt;br /&gt;152&lt;br /&gt;153&lt;br /&gt;154&lt;br /&gt;155&lt;br /&gt;156&lt;br /&gt;157&lt;br /&gt;158&lt;br /&gt;159&lt;br /&gt;160&lt;br /&gt;161&lt;br /&gt;162&lt;br /&gt;163&lt;br /&gt;164&lt;br /&gt;165&lt;br /&gt;166&lt;br /&gt;167&lt;br /&gt;168&lt;br /&gt;169&lt;br /&gt;170&lt;br /&gt;171&lt;br /&gt;172&lt;br /&gt;173&lt;br /&gt;174&lt;br /&gt;175&lt;br /&gt;176&lt;br /&gt;177&lt;br /&gt;178&lt;br /&gt;179&lt;br /&gt;180&lt;br /&gt;181&lt;br /&gt;182&lt;br /&gt;183&lt;br /&gt;184&lt;br /&gt;185&lt;br /&gt;186&lt;br /&gt;187&lt;br /&gt;188&lt;br /&gt;189&lt;br /&gt;190&lt;br /&gt;191&lt;br /&gt;192&lt;br /&gt;193&lt;br /&gt;194&lt;br /&gt;195&lt;br /&gt;196&lt;br /&gt;197&lt;br /&gt;198&lt;br /&gt;199&lt;br /&gt;200&lt;br /&gt;201&lt;br /&gt;202&lt;br /&gt;203&lt;br /&gt;204&lt;br /&gt;205&lt;br /&gt;206&lt;br /&gt;207&lt;br /&gt;208&lt;br /&gt;209&lt;br /&gt;210&lt;br /&gt;211&lt;br /&gt;212&lt;br /&gt;213&lt;br /&gt;214&lt;br /&gt;&lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;/*&amp;nbsp;=================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;Arduino&amp;nbsp;Heart&amp;nbsp;rate&amp;nbsp;monitor&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;21st&amp;nbsp;April&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;Processing&amp;nbsp;IDE:&amp;nbsp;2.2.1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;A&amp;nbsp;Grove&amp;nbsp;Ear-clip&amp;nbsp;heart&amp;nbsp;rate&amp;nbsp;sensor&amp;nbsp;allows&amp;nbsp;an&amp;nbsp;Arduino&amp;nbsp;UNO&amp;nbsp;to&amp;nbsp;sense&amp;nbsp;your&amp;nbsp;pulse.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;data&amp;nbsp;obtained&amp;nbsp;by&amp;nbsp;the&amp;nbsp;Arduino&amp;nbsp;can&amp;nbsp;then&amp;nbsp;be&amp;nbsp;sent&amp;nbsp;to&amp;nbsp;the&amp;nbsp;computer&amp;nbsp;via&amp;nbsp;Serial&amp;nbsp;communication&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;which&amp;nbsp;is&amp;nbsp;then&amp;nbsp;displayed&amp;nbsp;graphically&amp;nbsp;using&amp;nbsp;this&amp;nbsp;Processing&amp;nbsp;sketch.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;===================================================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;import&lt;/span&gt; processing.serial.*;                             &lt;span style=&quot;color: #666666;&quot;&gt;// Import the serial library to allow Serial communication with the Arduino&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; numOfRecs = 45;                                     &lt;span style=&quot;color: #666666;&quot;&gt;//   numOfRecs: The number of rectangles to display across the screen&lt;/span&gt;&lt;br /&gt;Rectangle[]&amp;nbsp;myRecs&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;new&lt;/span&gt; Rectangle[numOfRecs];          &lt;span style=&quot;color: #666666;&quot;&gt;//    myRecs[]: Is the array of Rectangles.  Rectangle is a custom class (programmed within this sketch)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Serial&amp;nbsp;myPort;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;String&lt;/span&gt; comPortString=&lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt;;                              &lt;span style=&quot;color: #666666;&quot;&gt;//comPortString: Is used to hold the string received from the Arduino&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt; arduinoValue = 0;                                 &lt;span style=&quot;color: #666666;&quot;&gt;//arduinoValue: Is the float variable converted from comPortString&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;boolean&lt;/span&gt; beat = &lt;span style=&quot;color: #33997E;&quot;&gt;false&lt;/span&gt;;                                   &lt;span style=&quot;color: #666666;&quot;&gt;//        beat: Used to control for multiple high/low signals coming from the Arduino&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; totalTime = 0;                                      &lt;span style=&quot;color: #666666;&quot;&gt;//   totalTime: Is the variable used to identify the total time between beats&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; lastTime = 0;                                       &lt;span style=&quot;color: #666666;&quot;&gt;//    lastTime: Is the variable used to remember when the last beat took place&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; beatCounter = 0;                                    &lt;span style=&quot;color: #666666;&quot;&gt;// beatCounter: Is used to keep track of the number of beats (in order to calculate the average BPM)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; totalBeats = 10;                                    &lt;span style=&quot;color: #666666;&quot;&gt;//  totalBeats: Tells the computer that we want to calculate the average BPM using 10 beats.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt;[] BPM = &lt;span style=&quot;color: #33997E;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt;[totalBeats];                        &lt;span style=&quot;color: #666666;&quot;&gt;//       BPM[]: Is the Beat Per Minute (BPM) array - to hold 10 BPM calculations&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; sumBPM = 0;                                         &lt;span style=&quot;color: #666666;&quot;&gt;//      sumBPM: Is used to sum the BPM[] array values, and is then used to calculate the average BPM.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; avgBPM = 0;                                         &lt;span style=&quot;color: #666666;&quot;&gt;//      avgBPM: Is the variable used to hold the average BPM calculated value.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;PFont&lt;/span&gt; f, f2;                                            &lt;span style=&quot;color: #666666;&quot;&gt;//     f &amp;amp; f2 : Are font related variables. Used to store font properties. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==SETUP==============================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;&lt;b&gt;setup&lt;/b&gt;&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;size&lt;/span&gt;(&lt;span style=&quot;color: #D94A7A;&quot;&gt;displayWidth&lt;/span&gt;,&lt;span style=&quot;color: #D94A7A;&quot;&gt;displayHeight&lt;/span&gt;);                     &lt;span style=&quot;color: #666666;&quot;&gt;// Set the size of the display to match the monitor width and height&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;smooth&lt;/span&gt;();                                             &lt;span style=&quot;color: #666666;&quot;&gt;// Draw all shapes with smooth edges.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;f&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;createFont&lt;/span&gt;(&lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;quot;Arial&amp;quot;&lt;/span&gt;,24);                           &lt;span style=&quot;color: #666666;&quot;&gt;// Initialise the &amp;quot;f&amp;quot; font variable    - used for the &amp;quot;calibrating&amp;quot; text displayed at the beginning&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;f2&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;createFont&lt;/span&gt;(&lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;quot;Arial&amp;quot;&lt;/span&gt;,96);                          &lt;span style=&quot;color: #666666;&quot;&gt;// Initialise the &amp;quot;f2&amp;quot; font variable   - used for the avgBPM display on screen&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; i=0; i&amp;lt;numOfRecs; i++){                       &lt;span style=&quot;color: #666666;&quot;&gt;// Initialise the array of rectangles&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myRecs[i]&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;new&lt;/span&gt; Rectangle(i, numOfRecs);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; i=0; i&amp;lt;totalBeats; i++){                      &lt;span style=&quot;color: #666666;&quot;&gt;// Initialise the BPM array&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;BPM[i]&amp;nbsp;=&amp;nbsp;0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;myPort&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;new&lt;/span&gt; Serial(&lt;span style=&quot;color: #33997E;&quot;&gt;this&lt;/span&gt;, Serial.&lt;span style=&quot;color: #006699;&quot;&gt;list&lt;/span&gt;()[0], 9600);    &lt;span style=&quot;color: #666666;&quot;&gt;// Start Serial communication with the Arduino using a baud rate of 9600&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;myPort.bufferUntil(&lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;apos;\n&amp;apos;&lt;/span&gt;);                             &lt;span style=&quot;color: #666666;&quot;&gt;// Trigger a SerialEvent on new line&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==DRAW==============================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;&lt;b&gt;draw&lt;/b&gt;&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;background&lt;/span&gt;(0);                                        &lt;span style=&quot;color: #666666;&quot;&gt;// Set the background to BLACK (this clears the screen each time)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;drawRecs();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Method call to draw the rectangles on the screen&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;drawBPM();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Method call to draw the avgBPM value to the top right of the screen&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==drawRecs==========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; drawRecs(){                                        &lt;span style=&quot;color: #666666;&quot;&gt;// This custom method will draw the rectangles on the screen                                &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;myRecs[0].setSize(arduinoValue);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Set the first rectangle to match arduinoValue; any positive value will start the animation.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; i=numOfRecs-1; i&amp;gt;0; i--){                     &lt;span style=&quot;color: #666666;&quot;&gt;// The loop counts backwards for coding efficiency - and is used to draw all of the rectangles to screen&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myRecs[i].setMult(i);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// setMulti creates the specific curve pattern. &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myRecs[i].setRed(avgBPM);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// The rectangles become more &amp;quot;Red&amp;quot; with higher avgBPM values&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myRecs[i].setSize(myRecs[i-1].getH());&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// The current rectangle size is determined by the height of the rectangle immediately to it&amp;apos;s left&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;fill&lt;/span&gt;(myRecs[i].getR(),myRecs[i].getG(), myRecs[i].getB());                     &lt;span style=&quot;color: #666666;&quot;&gt;// Set the colour of this rectangle&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;rect&lt;/span&gt;(myRecs[i].getX(), myRecs[i].getY(), myRecs[i].getW(), myRecs[i].getH());  &lt;span style=&quot;color: #666666;&quot;&gt;// Draw this rectangle&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==drawBPM===========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; drawBPM(){                                         &lt;span style=&quot;color: #666666;&quot;&gt;// This custom method is used to calculate the avgBPM and draw it to screen.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;sumBPM&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Reset the sumBPM variable&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;avgBPM&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Reset the avgBPM variable&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;boolean&lt;/span&gt; calibrating = &lt;span style=&quot;color: #33997E;&quot;&gt;false&lt;/span&gt;;                          &lt;span style=&quot;color: #666666;&quot;&gt;// calibrating: this boolean variable is used to control when the avgBPM is displayed to screen&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; i=1; i&amp;lt;totalBeats; i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sumBPM&amp;nbsp;=&amp;nbsp;sumBPM&amp;nbsp;+&amp;nbsp;BPM[i-1];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Sum all of the BPM values in the BPM array.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt;(BPM[i-1]&amp;lt;1){                                     &lt;span style=&quot;color: #666666;&quot;&gt;// If any BPM values are equal to 0, then set the calibrating variable to true. &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;calibrating&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;true&lt;/span&gt;;                               &lt;span style=&quot;color: #666666;&quot;&gt;// This will be used later to display &amp;quot;calibrating&amp;quot; on the screen.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;avgBPM&amp;nbsp;=&amp;nbsp;sumBPM/(totalBeats-1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Calculate the average BPM from all BPM values&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;fill&lt;/span&gt;(255);                                            &lt;span style=&quot;color: #666666;&quot;&gt;// The text will be displayed as WHITE text&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt;(calibrating){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;textFont&lt;/span&gt;(f);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;text&lt;/span&gt;(&lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;quot;Calibrating&amp;quot;&lt;/span&gt;, (4*&lt;span style=&quot;color: #D94A7A;&quot;&gt;width&lt;/span&gt;)/5, (&lt;span style=&quot;color: #D94A7A;&quot;&gt;height&lt;/span&gt;/5));      &lt;span style=&quot;color: #666666;&quot;&gt;// If the calibrating variable is TRUE, then display the word &amp;quot;Calibrating&amp;quot; on screen&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;fill&lt;/span&gt;(0);                                           &lt;span style=&quot;color: #666666;&quot;&gt;// Change the fill and stroke to black (0) so that other text is &amp;quot;hidden&amp;quot; while calibrating variable is TRUE&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;stroke&lt;/span&gt;(0);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;textFont&lt;/span&gt;(f2);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;text&lt;/span&gt;(avgBPM, (4*&lt;span style=&quot;color: #D94A7A;&quot;&gt;width&lt;/span&gt;)/5, (&lt;span style=&quot;color: #D94A7A;&quot;&gt;height&lt;/span&gt;/5));             &lt;span style=&quot;color: #666666;&quot;&gt;// If the calibrating variable is FALSE, then display the avgBPM variable on screen&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;stroke&lt;/span&gt;(255);                                       &lt;span style=&quot;color: #666666;&quot;&gt;// Change the stroke to white (255) to show the white line underlying the word BPM.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;textFont&lt;/span&gt;(f);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;text&lt;/span&gt;(&lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;quot;BPM&amp;quot;&lt;/span&gt;, (82*&lt;span style=&quot;color: #D94A7A;&quot;&gt;width&lt;/span&gt;)/100, (&lt;span style=&quot;color: #D94A7A;&quot;&gt;height&lt;/span&gt;/11));           &lt;span style=&quot;color: #666666;&quot;&gt;// This will display the underlined word &amp;quot;BPM&amp;quot; when calibrating variable is FALSE.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;line&lt;/span&gt;((80*&lt;span style=&quot;color: #D94A7A;&quot;&gt;width&lt;/span&gt;)/100, (&lt;span style=&quot;color: #D94A7A;&quot;&gt;height&lt;/span&gt;/10),(88*&lt;span style=&quot;color: #D94A7A;&quot;&gt;width&lt;/span&gt;)/100, (&lt;span style=&quot;color: #D94A7A;&quot;&gt;height&lt;/span&gt;/10));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;stroke&lt;/span&gt;(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==serialEvent===========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; serialEvent(Serial cPort){                        &lt;span style=&quot;color: #666666;&quot;&gt;// This will be triggered every time a &amp;quot;new line&amp;quot; of data is received from the Arduino&lt;/span&gt;&lt;br /&gt;&amp;nbsp;comPortString&amp;nbsp;=&amp;nbsp;cPort.readStringUntil(&lt;span style=&quot;color: #7D4793;&quot;&gt;&amp;apos;\n&amp;apos;&lt;/span&gt;);          &lt;span style=&quot;color: #666666;&quot;&gt;// Read this data into the comPortString variable.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt;(comPortString != &lt;span style=&quot;color: #33997E;&quot;&gt;null&lt;/span&gt;) {                           &lt;span style=&quot;color: #666666;&quot;&gt;// If the comPortString variable is not NULL then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;comPortString=&lt;span style=&quot;color: #006699;&quot;&gt;trim&lt;/span&gt;(comPortString);                  &lt;span style=&quot;color: #666666;&quot;&gt;// trim any white space around the text.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; i = &lt;span style=&quot;color: #006699;&quot;&gt;int&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;map&lt;/span&gt;(&lt;span style=&quot;color: #E2661A;&quot;&gt;Integer&lt;/span&gt;.&lt;span style=&quot;color: #006699;&quot;&gt;parseInt&lt;/span&gt;(comPortString),1,1023,1,&lt;span style=&quot;color: #D94A7A;&quot;&gt;height&lt;/span&gt;));  &lt;span style=&quot;color: #666666;&quot;&gt;// convert the string to an integer, and map the value so that the rectangle will fit within the screen.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arduinoValue&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;float&lt;/span&gt;(i);                            &lt;span style=&quot;color: #666666;&quot;&gt;// Convert the integer into a float value.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt; (!beat){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt;(arduinoValue&amp;gt;0){                               &lt;span style=&quot;color: #666666;&quot;&gt;// When a beat is detected, the &amp;quot;trigger&amp;quot; method is called.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;trigger(&lt;span style=&quot;color: #006699;&quot;&gt;millis&lt;/span&gt;());                              &lt;span style=&quot;color: #666666;&quot;&gt;// millis() creates a timeStamp of when the beat occured.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;beat=&lt;span style=&quot;color: #33997E;&quot;&gt;true&lt;/span&gt;;                                      &lt;span style=&quot;color: #666666;&quot;&gt;// The beat variable is changed to TRUE to register that a beat has been detected.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt; (arduinoValue&amp;lt;1){                                &lt;span style=&quot;color: #666666;&quot;&gt;// When the Arduino value returns back to zero, we will need to change the beat status to FALSE.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;beat&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==trigger===========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; trigger(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; time){                                &lt;span style=&quot;color: #666666;&quot;&gt;// This method is used to calculate the Beats per Minute (BPM) and to store the last 10 BPMs into the BPM[] array.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;totalTime&amp;nbsp;=&amp;nbsp;time&amp;nbsp;-&amp;nbsp;lastTime;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// totalTime = the current beat time minus the last time there was a beat.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;lastTime&amp;nbsp;=&amp;nbsp;time;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Set the lastTime variable to the current &amp;quot;time&amp;quot; for the next round of calculations.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;BPM[beatCounter]&amp;nbsp;=&amp;nbsp;60000/totalTime;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Calculate BPM from the totalTime. 60000 = 1 minute.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;beatCounter++;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Increment the beatCounter &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt; (beatCounter&amp;gt;totalBeats-1){                       &lt;span style=&quot;color: #666666;&quot;&gt;// Reset the beatCounter when the total number of BPMs have been stored into the BPM[] array.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;beatCounter=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// This allows us to keep the last 10 BPM calculations at all times.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==sketchFullScreen==========================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #E2661A;&quot;&gt;boolean&lt;/span&gt; sketchFullScreen() {                           &lt;span style=&quot;color: #666666;&quot;&gt;// This puts Processing into Full Screen Mode&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #33997E;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//==Rectangle&amp;nbsp;CLASS==================================================================================*********&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #33997E;&quot;&gt;class&lt;/span&gt; Rectangle{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt; xPos, defaultY, yPos, myWidth, myHeight, myMultiplier;    &lt;span style=&quot;color: #666666;&quot;&gt;// Variables used for drawing rectangles&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; blueVal, greenVal, redVal;                                  &lt;span style=&quot;color: #666666;&quot;&gt;// Variables used for the rectangle colour&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;Rectangle(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; recNum, &lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; nRecs){                               &lt;span style=&quot;color: #666666;&quot;&gt;// The rectangles are constructed using two variables. The total number of rectangles to be displayed, and the identification of this rectangle (recNum)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myWidth&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #D94A7A;&quot;&gt;displayWidth&lt;/span&gt;/nRecs;                                 &lt;span style=&quot;color: #666666;&quot;&gt;// The width of the rectangle is determined by the screen width and the total number of rectangles.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xPos&amp;nbsp;=&amp;nbsp;recNum&amp;nbsp;*&amp;nbsp;myWidth;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// The x Position of this rectangle is determined by the width of the rectangles (all same) and the rectangle identifier.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;defaultY=&lt;span style=&quot;color: #D94A7A;&quot;&gt;displayHeight&lt;/span&gt;/2;                                     &lt;span style=&quot;color: #666666;&quot;&gt;// The default Y position of the rectangle is half way down the screen.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;yPos&amp;nbsp;=&amp;nbsp;defaultY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// yPos is used to adjust the position of the rectangle as the size changes.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myHeight&amp;nbsp;=&amp;nbsp;1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// The height of the rectangle starts at 1 pixel&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myMultiplier&amp;nbsp;=&amp;nbsp;1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// The myMultiplier variable will be used to create the funnel shaped path for the rectangles.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;redVal&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// The red Value starts off being 0 - but changes with avgBPM. Higher avgBPM means higher redVal&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;if&lt;/span&gt; (recNum&amp;gt;0){                                                &lt;span style=&quot;color: #666666;&quot;&gt;// The blue Value progressively increases with every rectangle (moving to the right of the screen)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;blueVal&amp;nbsp;=&amp;nbsp;(recNum*255)/nRecs;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #669900;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;blueVal&amp;nbsp;=&amp;nbsp;0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;greenVal&amp;nbsp;=&amp;nbsp;255-blueVal;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// Initially, the green value is at the opposite end of the spectrum to the blue value.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; setSize(&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt; newSize){                                    &lt;span style=&quot;color: #666666;&quot;&gt;// This is used to set the new size of each rectangle &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myHeight=newSize*myMultiplier;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;yPos=defaultY-(newSize/2);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; setMult(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; i){                                            &lt;span style=&quot;color: #666666;&quot;&gt;// The multiplier is a function of COS, which means that it varies from 1 to 0.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myMultiplier&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;cos&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;radians&lt;/span&gt;(i));                               &lt;span style=&quot;color: #666666;&quot;&gt;// You can try other functions to experience different effects.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;void&lt;/span&gt; setRed(&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; r){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;redVal&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #006699;&quot;&gt;int&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;constrain&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;map&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;float&lt;/span&gt;(r), 60, 100, 0, 255),0,255)); &lt;span style=&quot;color: #666666;&quot;&gt;// setRed is used to change the redValue based on the &amp;quot;normal&amp;quot; value for resting BPM (60-100). &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;greenVal&amp;nbsp;=&amp;nbsp;255&amp;nbsp;-&amp;nbsp;redVal;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// When the avgBPM &amp;gt; 100, redVal will equal 255, and the greenVal will equal 0.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;// When the avgBPM &amp;lt; 60, redVal will equal 0, and greenVal will equal 255.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt;  getX(){                                                   &lt;span style=&quot;color: #666666;&quot;&gt;// get the x Position of the rectangle&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; xPos;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt; getY(){                                                    &lt;span style=&quot;color: #666666;&quot;&gt;// get the y Position of the rectangle&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; yPos;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt; getW(){                                                    &lt;span style=&quot;color: #666666;&quot;&gt;// get the width of the rectangle&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; myWidth;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt; getH(){                                                    &lt;span style=&quot;color: #666666;&quot;&gt;// get the height of the rectangle&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; myHeight;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;float&lt;/span&gt; getM(){                                                    &lt;span style=&quot;color: #666666;&quot;&gt;// get the Multiplier of the rectangle&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; myMultiplier;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; getB(){                                                      &lt;span style=&quot;color: #666666;&quot;&gt;// get the &amp;quot;blue&amp;quot; component of the rectangle colour&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; blueVal;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; getR(){                                                      &lt;span style=&quot;color: #666666;&quot;&gt;// get the &amp;quot;red&amp;quot; component of the rectangle colour&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; redVal;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #E2661A;&quot;&gt;int&lt;/span&gt; getG(){                                                      &lt;span style=&quot;color: #666666;&quot;&gt;// get the &amp;quot;green&amp;quot; component of the rectangle colour&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #33997E;&quot;&gt;return&lt;/span&gt; greenVal;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt; &lt;P&gt;   &lt;h4&gt;Processing Code Discussion:&lt;/h4&gt;&lt;br&gt;      &lt;P&gt;       The Rectangle class was created to store relevant information about each rectangle.        By using a custom class, we were able to design our rectangles any way we wanted.        These rectangles have properties and methods which allow us to easily control their        position, size and colour. By adding some smart functionality to each rectangle, we were able to get the rectangle to automatically        position and colour itself based on key values. &lt;/P&gt;       &lt;P&gt;        The Serial library is used to allow communication with the Arduino. In this Processing sketch, the values obtained from the Arduino         were converted to floats to allow easy calulations of the beats per minute (BPM).         I am aware that I have over-engineered the serialEvent method somewhat, because the Arduino         is only really sending two values. I didn&#39;t really need to convert the String. But I am happy with         the end result, and it does the job I needed it to...        &lt;/P&gt;        &lt;div style=&quot;text-align: center;&quot;&gt;          &lt;P&gt;                &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;                    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwYts28ZRK2WJS4s8swHi7Fh40Pw4ObosfKn0Vq8W5_PdOxO0Z9alDtICDMEwIh1BXly8IDuqMXzsbmk1XzWgx3Wc1IYE3qOH8dh9foCCqiYKtRnwXb6GRRfsa9Wcv_J_lvwStp3sQdnU/s1600/Complete+Workstation2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwYts28ZRK2WJS4s8swHi7Fh40Pw4ObosfKn0Vq8W5_PdOxO0Z9alDtICDMEwIh1BXly8IDuqMXzsbmk1XzWgx3Wc1IYE3qOH8dh9foCCqiYKtRnwXb6GRRfsa9Wcv_J_lvwStp3sQdnU/s1600/Complete+Workstation2.jpg&quot; height=&quot;526&quot; width=&quot;640&quot; /&gt;                    &lt;/a&gt;                &lt;/div&gt;            &lt;/P&gt;        &lt;/div&gt;     &lt;/P&gt;&lt;/div&gt;&lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;P&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;     This project is quite simple. I designed it so that you could omit the Processing code if you wanted to.      In that scenario, you would only be left with a blinking LED that blinks in time with your pulse.      The Processing code takes this project to the next level. It provides a nice animation and calculates         the beats per minute (BPM). &lt;br&gt; &amp;nbsp;         &lt;br&gt;        I hope you liked this tutorial. Please feel free to share it, comment or give it a plus one.         If you didn&#39;t like it, I would still appreciate your constructive feedback.  &lt;/div&gt; &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;         &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;                &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLAeKVfZmLqA13PNGPr89SCMEg5UIsaONedH1-y9yVV5lz_Ph7UubIDbqSrJkkDC8n0L0ldAv2lxYR-ULio5ChzvLS4IAC0dTVXC_7Ws08FZaZY46mCYetmJn1mYyuEea8TaeBRswWVjs/s1600/Slide1.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLAeKVfZmLqA13PNGPr89SCMEg5UIsaONedH1-y9yVV5lz_Ph7UubIDbqSrJkkDC8n0L0ldAv2lxYR-ULio5ChzvLS4IAC0dTVXC_7Ws08FZaZY46mCYetmJn1mYyuEea8TaeBRswWVjs/s1600/Slide1.JPG&quot; height=&quot;150&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt;  &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/4007741960697039807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/04/arduino-heart-rate-monitor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4007741960697039807'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4007741960697039807'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/04/arduino-heart-rate-monitor.html' title='Arduino Heart Rate Monitor'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/jXKNWb1esoc/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-3209401969365704308</id><published>2015-04-14T08:21:00.000+07:00</published><updated>2018-03-28T22:35:15.176+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino LLC"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino SRL"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="OneArduino"/><category scheme="http://www.blogger.com/atom/ns#" term="poll"/><title type='text'>One Arduino</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhygbTdiokiuq9Ptyq3YovYbPZ7KQz-ppdegOwDb2y4bppfeVtKGjS3K9luISec34myaoieWZwdbA5xzvbrq3luX4yC3gPXF59hGhHwFnK_TI0dI9F0N-vasFWWr6ltxP0DtwNgX_FNUZg/s1600/ONE+ARDUINO2c.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhygbTdiokiuq9Ptyq3YovYbPZ7KQz-ppdegOwDb2y4bppfeVtKGjS3K9luISec34myaoieWZwdbA5xzvbrq3luX4yC3gPXF59hGhHwFnK_TI0dI9F0N-vasFWWr6ltxP0DtwNgX_FNUZg/s640/ONE+ARDUINO2c.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;/P&gt; &lt;br&gt; &lt;P&gt; &lt;h3&gt;Arduino&lt;/h3&gt; is an &quot;open source physical computing platform based on a simple microcontroller board&quot;. It is also a &quot;development environment for writing software for the board&quot; (Source: &lt;a href=&quot;http://arduino.cc/en/guide/introduction&quot;&gt;Arduino.cc&lt;/a&gt;).  The first Arduino was born in 2005 in the classrooms of Interactive Design Institute in Ivrea, Italy. A nice presentation which  shows a timeline of &quot;how Arduino came to be&quot; can be found &lt;a href=&quot;http://www.cs.colorado.edu/~kena/classes/5448/f11/presentation-materials/arduino_bradleycooper.pdf&quot;&gt;here&lt;/a&gt;.&lt;br&gt; &amp;nbsp;  &lt;br&gt;    Arduino has been a very successful concept and creation. Ten years on, it has become one of, if not, the most popular prototyping and development platforms in the world.     It has found it&#39;s way into the hearts of many makers, artists, programmers, developers and inventors. It has been used for     millions of projects: from automatic garage door openers and tea makers to flamethrowers, robots, lighting displays and sound production. In     fact, I cannot think of anything that the Arduino hasn&#39;t been used for.&lt;br&gt; &amp;nbsp;      &lt;br&gt;    But as you are pretty well aware, there has been a recent rift between the original founders of Arduino.&lt;BR&gt; There is no need to go over the details here because it has been covered many times already on other sites.     But if you would like to get up to speed on the Arduino Trademark dispute, I would suggest you read the following articles: &lt;br&gt; &amp;nbsp;     &lt;br&gt; &amp;nbsp; 1) &lt;a href=&quot;http://makezine.com/2015/03/19/massimo-banzi-fighting-for-arduino/&quot;&gt;Massimo Banzi&#39;s interview on Make &lt;/a&gt;&lt;br&gt; &amp;nbsp; 2) &lt;a href=&quot;http://arduino.org/blog/1-the-new-blog/to-the-makers&quot;&gt;Federico&#39;s letter to the makers on Arduino.org &lt;/a&gt;&lt;br&gt; &amp;nbsp; 3) &lt;a href=&quot;https://www.unitedstatescourts.org/federal/mad/167131/1-0.html&quot;&gt;Court Transcripts from the United States Courts Archive&lt;/a&gt;&lt;br&gt; &amp;nbsp; 4) &lt;a href=&quot;http://www.zdnet.com/article/whats-in-a-name-the-battle-for-the-soul-of-arduino/&quot;&gt;What&#39;s in a name: The battle for the soul of Arduino  - on ZD Net&lt;/a&gt;&lt;br&gt; &amp;nbsp; 5) &lt;a href =&quot;http://hackaday.com/2015/03/12/arduino-v-arduino-part-ii/&quot;&gt;Arduino vs Arduino: Part II   on Hackaday&lt;/a&gt;&lt;br&gt;  &lt;/P&gt;  &lt;br&gt; &amp;nbsp;   &lt;br&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt; &lt;/P&gt; &lt;P&gt; &lt;h4&gt;My Letter to Arduino LLC/SRL&lt;/h4&gt;&lt;br&gt; Why can&#39;t you get along? Why the deception? Why the greed? &lt;br&gt; &amp;nbsp;  &lt;br&gt; Who does this benefit? It is a lose-lose battle, not only for Arduino SRL/LLC  but for the whole Arduino community. We all love Arduino. We love the idea, the mission and the dream.  We like to make things... We don&#39;t care who &quot;the original&quot; Arduino was or is. It doesn&#39;t matter.  We just want...     &lt;h3&gt;    &lt;ul&gt;        &lt;li&gt;&lt;a href=&quot;http://www.baldengineer.com/videos/open-letter-to-arduino-llc-and-arduino-srl&quot;&gt;#OneArduino&lt;/a&gt;&lt;/li&gt;        &lt;li&gt;&lt;a href=&quot;http://brainwagon.org/2015/03/31/arduino-perhaps-we-need-ourduino/&quot;&gt;#OurDuino&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt;    &lt;/h3&gt;    &lt;/P&gt;    &lt;P&gt;    We don&#39;t want different versions of the Arduino IDE (&lt;a href=&quot;http://arduino.cc/en/main/software&quot;&gt;1.6.3&lt;/a&gt; vs &lt;a href=&quot;http://arduino.org/downloads&quot;&gt;1.7.0&lt;/a&gt;).&lt;br&gt;    Some may say that you should redo the IDE altogether, but that is an entirely different topic :)&lt;br&gt;    &lt;/P&gt;    &lt;P&gt;    Can&#39;t you see what this is doing? &lt;br&gt;    It is hard enough for tutorial makers and forum dwellers to keep up with the ever evolving IDE as it is.     Making two different versions of the &quot;same IDE&quot; adds about 10 layers of confusion and complexity ! And for what ???     This will be confusing for the newbie, confusing for the helpers, the developers, for everyone. &lt;br&gt;    &lt;/P&gt;    &lt;P&gt;    I am guessing that my words will have no influence over your decisions. But I hope it does !&lt;br&gt;    I plee with both of you to stand by your infinity symbol and work through your differences. Say what you need to say, but     get back together and regroup - as ONE ARDUINO.     &lt;/P&gt;    &lt;P&gt;    Your rift is likely to reverberate through to the Arduino Community aswell. Some people will side with     Arduino LLC, some with Arduino SRL. And while some people will take a stance of indifference, there will be some that just look elsewhere. &lt;br&gt; &amp;nbsp;     &lt;br&gt;    I don&#39;t know if revealing the results of my poll will benefit the cause or add salt to the wounds,     But I asked the question, and you probably want to know the answer.     Who does the Arduino Community support right now? &lt;br&gt;  &amp;nbsp;     &lt;br&gt;    The infographic below shows the results of the poll I posted a week ago:     &lt;/P&gt;    &lt;P&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj-wj464D5GHnZLqLWJgS4uxGiBsN6fbHTttP0qPJIIyHPXw5siyIWfqOBgeccnUIDp2_X-m8evT3JcJ9OjnRuGnwW0nIe60p60HrfNm-0kmH-Hpr6NzGNdnpx69ya12z7yx50WD9RWvQ/s1600/Arduino+Wars+PiktoChart.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj-wj464D5GHnZLqLWJgS4uxGiBsN6fbHTttP0qPJIIyHPXw5siyIWfqOBgeccnUIDp2_X-m8evT3JcJ9OjnRuGnwW0nIe60p60HrfNm-0kmH-Hpr6NzGNdnpx69ya12z7yx50WD9RWvQ/s1600/Arduino+Wars+PiktoChart.png&quot; width=&quot;640&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;    &lt;/P&gt;    &lt;P&gt;    &lt;span style=&quot;font-size: xx-small;&quot;&gt;    This poll was posted on the &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/communities/104815959638799239380&quot;&gt;Arduino Tutorial Google+ community page &lt;/a&gt;.     I tried to be as unbiased as possible. People were only allowed to vote once (enforced by log in).     Each voter would have been presented with the organisations in random order. And results were not published until now. The results above are accurate as of 14th April 2015 at 9am (in Australia) &lt;/span&gt; &lt;br&gt; &amp;nbsp;     &lt;br&gt; &lt;/P&gt;  &lt;P&gt;    As you can clearly see, Arduino LLC is highly favoured.  &lt;br&gt; &amp;nbsp;     &lt;br&gt;    My personal preference is not captured by that infographic.     I agree with the &lt;a href=&quot;http://www.baldengineer.com/videos/open-letter-to-arduino-llc-and-arduino-srl&quot;&gt;bald engineer&lt;/a&gt;, I would prefer #OneArduino.     I would like the Arduino Community to stand united. I also want the Arduino founders to stand united! Please, work through your issues, stop being greedy and stop the deception.     Arduino is more than a product. It is the heart of a greater movement. &lt;br&gt;    &lt;div style=&quot;text-align: center;&quot;&gt;        &lt;span style=&quot;font-size: large;&quot;&gt; This war is pointless - please STOP !&lt;/span&gt;&lt;/div&gt; &lt;/P&gt;    Kind Regards&lt;br&gt;    Scott C     &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt; &lt;/P&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/3209401969365704308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/04/one-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/3209401969365704308'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/3209401969365704308'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/04/one-arduino.html' title='One Arduino'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhygbTdiokiuq9Ptyq3YovYbPZ7KQz-ppdegOwDb2y4bppfeVtKGjS3K9luISec34myaoieWZwdbA5xzvbrq3luX4yC3gPXF59hGhHwFnK_TI0dI9F0N-vasFWWr6ltxP0DtwNgX_FNUZg/s72-c/ONE+ARDUINO2c.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-3255297670382160582</id><published>2015-04-10T01:01:00.000+07:00</published><updated>2018-03-28T22:35:15.271+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="button"/><category scheme="http://www.blogger.com/atom/ns#" term="Capacitance"/><category scheme="http://www.blogger.com/atom/ns#" term="Capacitive"/><category scheme="http://www.blogger.com/atom/ns#" term="Grove"/><category scheme="http://www.blogger.com/atom/ns#" term="LED"/><category scheme="http://www.blogger.com/atom/ns#" term="MP3"/><category scheme="http://www.blogger.com/atom/ns#" term="Player"/><category scheme="http://www.blogger.com/atom/ns#" term="Portable"/><category scheme="http://www.blogger.com/atom/ns#" term="Potentiometer"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Seeed Studio"/><category scheme="http://www.blogger.com/atom/ns#" term="SeeedStudio"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial"/><category scheme="http://www.blogger.com/atom/ns#" term="Slide Potentiometer"/><category scheme="http://www.blogger.com/atom/ns#" term="Sound"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Arduino BeatBox</title><content type='html'> &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_MJXQQz8Upc7se50RFqLFZCXeMr6NS3i-E5pj4c77RmXJME73vmv4VDWnIFmgWK1dCJ3b_JZT7tdp8qHVZFmjYku8Rxi6WAhQlflufxVXQYi0DQwGJsjZ6TTvn4liWGyAk_FZFYN1Nxk/s1600/Slide1.JPG&quot; height=&quot;240&quot; width=&quot;98%&quot; /&gt;        &lt;/div&gt; &lt;/P&gt; &lt;P&gt;  &lt;div&gt;   &lt;P&gt; Create your very own Arduino BeatBox ! &lt;/P&gt;   &lt;P&gt;    Home-made capacitive touch sensors are used to trigger the MP3 drum sounds stored on the Grove Serial MP3 player.        I have used a number of tricks to get the most out of this module, and I was quite impressed on how well it did.        Over 130 sounds were loaded onto the SDHC card. Most were drum sounds, but I added some farm animal noises        to provide an extra element of surprise and entertainment. You can put any sounds you want on the module and play them back        quickly. We&#39;ll put the Grove Serial MP3 module through it&#39;s paces and make it into a neat little BeatBox !!     &lt;/P&gt;    &lt;BR /&gt;   &lt;P&gt; &lt;h4&gt;Key learning objectives&lt;/h4&gt;        &lt;ul&gt;                    &lt;li&gt;How to make your own beatbox&lt;/li&gt;                    &lt;li&gt;How to make capacitive drum pad sensors without using resistors&lt;/li&gt;                    &lt;li&gt;How to speed up Arduino&#39;s Analog readings for better performance&lt;/li&gt;                    &lt;li&gt;How to generate random numbers on your Arduino&lt;/li&gt;                 &lt;/ul&gt;            &lt;/P&gt;  &lt;/div&gt; &lt;/P&gt;  &lt;BR /&gt; &lt;P&gt;  &lt;H4&gt;Parts Required:&lt;/H4&gt;  &lt;P&gt;   &lt;ul&gt;       &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Freetronics-Eleven-100-Arduino-Uno-Compatible-p/ard-1002.htm&quot;&gt;Arduino UNO or compatible board&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Base-Shield-v1-3-p/sld01099p.htm&quot;&gt;Grove Base Shield&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Serial-MP3-Player-p/sen01300p.htm&quot;&gt;Grove Serial MP3 Player&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Slide-Potentiometer-p/com05231p.htm&quot;&gt;Grove Sliding Potentiometer&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Button-p/com22242p.htm&quot;&gt;Grove Button&lt;/a&gt; or &lt;a href=&quot;http://www.epictinker.com/Grove-Button-P-p/com08211p.htm&quot;&gt;Grove Button (P)&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Universal-4-Pin-20cm-Cable-5pk-p/acc11317o.htm&quot;&gt;Grove Universal 4 pin cables&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/6xAA-Battery-Holder-with-DC-2-1mm-Power-Jack-p/fit0141.htm&quot;&gt;Battery Holder&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://bit.ly/1H4UHXa&quot;&gt;SanDisk 8GB Ultra Micro SDHC Memory card&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://lmgtfy.com/?q=DOSS+DS+1158&quot;&gt;Portable Powered Speaker&lt;/a&gt; or Headphones&lt;/li&gt;    &lt;li&gt;4 LEDs - 1 x Green, 1 x Blue, 1 x Red and 1 x Yellow&lt;/li&gt;    &lt;li&gt;A shoe box, paper, aluminum foil, scissors, glue etc. etc.&lt;/li&gt;&lt;br /&gt;   &lt;/ul&gt;  &lt;/P&gt; &lt;/P&gt; &lt;P&gt;&lt;H4&gt;Making the drum pads&lt;/H4&gt; &lt;/BR&gt;     &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1PIDfcaLtkYlPpJZ3kHYBu5r1UUdZt5xrYroByUqx-CX_zeVssYmZWbVw_Znnoabp27LL2fj_BdwDGkouFf_frs4dw3dzujkFf_e5-2eSFOdbeyL95C0OWfaLRc8zD_vKq9ff9EGyKkc/s1600/Putting+it+together.gif&quot; height=&quot;331&quot; width=&quot;400&quot; /&gt;        &lt;/div&gt;    &lt;/P&gt;    &lt;BR /&gt;&amp;nbsp;     &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Fritzing Sketch&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsjuqg6oQZFIVg9OGeBTVmlcwLXa7ZVErKZk1Ro7jzXHHgVY1IlCmOTYZCHkrcnT7Z-Q0i37dNosioMXFoMJMW95i83Ds6HsFdXIzGA9BmXuHpCX3K-Beyw30EVvIJTuTaeKb8utKAR_k/s1600/Slide12.JPG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Grove Connections&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTQhT3ciiP6U1tlpkq76PWetc_XAvJvVsLo99zUSqsHQorpq5MSj-EDshRrSVq38vbP9qu9bgRsseYDiIO5-BnyRxXwEHRpXMY9htro8gJeB-JmeQ_2DTNaTcrVA86oTGu-uPh_CEse60/s1600/Slide13.JPG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Grove Connections (without base shield)&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0wvb5sH3fnEGkPOOhyBMDdTTYUvAto2iJjuWd69as2DzZJ8T3BVGWPjaVxbJ2GmDx-qcGhbc04jKn7F985k9_54ClElLaBJYFJMu8nS0H8qG5BCGv4p61EG8nAu2y_izz9FUOdOaxS6E/s1600/Slide15.JPG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Arduino Sketch&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt;  1&lt;br /&gt;  2&lt;br /&gt;  3&lt;br /&gt;  4&lt;br /&gt;  5&lt;br /&gt;  6&lt;br /&gt;  7&lt;br /&gt;  8&lt;br /&gt;  9&lt;br /&gt; 10&lt;br /&gt; 11&lt;br /&gt; 12&lt;br /&gt; 13&lt;br /&gt; 14&lt;br /&gt; 15&lt;br /&gt; 16&lt;br /&gt; 17&lt;br /&gt; 18&lt;br /&gt; 19&lt;br /&gt; 20&lt;br /&gt; 21&lt;br /&gt; 22&lt;br /&gt; 23&lt;br /&gt; 24&lt;br /&gt; 25&lt;br /&gt; 26&lt;br /&gt; 27&lt;br /&gt; 28&lt;br /&gt; 29&lt;br /&gt; 30&lt;br /&gt; 31&lt;br /&gt; 32&lt;br /&gt; 33&lt;br /&gt; 34&lt;br /&gt; 35&lt;br /&gt; 36&lt;br /&gt; 37&lt;br /&gt; 38&lt;br /&gt; 39&lt;br /&gt; 40&lt;br /&gt; 41&lt;br /&gt; 42&lt;br /&gt; 43&lt;br /&gt; 44&lt;br /&gt; 45&lt;br /&gt; 46&lt;br /&gt; 47&lt;br /&gt; 48&lt;br /&gt; 49&lt;br /&gt; 50&lt;br /&gt; 51&lt;br /&gt; 52&lt;br /&gt; 53&lt;br /&gt; 54&lt;br /&gt; 55&lt;br /&gt; 56&lt;br /&gt; 57&lt;br /&gt; 58&lt;br /&gt; 59&lt;br /&gt; 60&lt;br /&gt; 61&lt;br /&gt; 62&lt;br /&gt; 63&lt;br /&gt; 64&lt;br /&gt; 65&lt;br /&gt; 66&lt;br /&gt; 67&lt;br /&gt; 68&lt;br /&gt; 69&lt;br /&gt; 70&lt;br /&gt; 71&lt;br /&gt; 72&lt;br /&gt; 73&lt;br /&gt; 74&lt;br /&gt; 75&lt;br /&gt; 76&lt;br /&gt; 77&lt;br /&gt; 78&lt;br /&gt; 79&lt;br /&gt; 80&lt;br /&gt; 81&lt;br /&gt; 82&lt;br /&gt; 83&lt;br /&gt; 84&lt;br /&gt; 85&lt;br /&gt; 86&lt;br /&gt; 87&lt;br /&gt; 88&lt;br /&gt; 89&lt;br /&gt; 90&lt;br /&gt; 91&lt;br /&gt; 92&lt;br /&gt; 93&lt;br /&gt; 94&lt;br /&gt; 95&lt;br /&gt; 96&lt;br /&gt; 97&lt;br /&gt; 98&lt;br /&gt; 99&lt;br /&gt;100&lt;br /&gt;101&lt;br /&gt;102&lt;br /&gt;103&lt;br /&gt;104&lt;br /&gt;105&lt;br /&gt;106&lt;br /&gt;107&lt;br /&gt;108&lt;br /&gt;109&lt;br /&gt;110&lt;br /&gt;111&lt;br /&gt;112&lt;br /&gt;113&lt;br /&gt;114&lt;br /&gt;115&lt;br /&gt;116&lt;br /&gt;117&lt;br /&gt;118&lt;br /&gt;119&lt;br /&gt;120&lt;br /&gt;121&lt;br /&gt;122&lt;br /&gt;123&lt;br /&gt;124&lt;br /&gt;125&lt;br /&gt;126&lt;br /&gt;127&lt;br /&gt;128&lt;br /&gt;129&lt;br /&gt;130&lt;br /&gt;131&lt;br /&gt;132&lt;br /&gt;133&lt;br /&gt;134&lt;br /&gt;135&lt;br /&gt;136&lt;br /&gt;137&lt;br /&gt;138&lt;br /&gt;139&lt;br /&gt;140&lt;br /&gt;141&lt;br /&gt;142&lt;br /&gt;143&lt;br /&gt;144&lt;br /&gt;145&lt;br /&gt;146&lt;br /&gt;147&lt;br /&gt;148&lt;br /&gt;149&lt;br /&gt;150&lt;br /&gt;151&lt;br /&gt;152&lt;br /&gt;153&lt;br /&gt;154&lt;br /&gt;155&lt;br /&gt;156&lt;br /&gt;157&lt;br /&gt;158&lt;br /&gt;159&lt;br /&gt;160&lt;br /&gt;161&lt;br /&gt;162&lt;br /&gt;163&lt;br /&gt;164&lt;br /&gt;165&lt;br /&gt;166&lt;br /&gt;167&lt;br /&gt;168&lt;br /&gt;169&lt;br /&gt;170&lt;br /&gt;171&lt;br /&gt;172&lt;br /&gt;173&lt;br /&gt;174&lt;br /&gt;175&lt;br /&gt;176&lt;br /&gt;177&lt;br /&gt;178&lt;br /&gt;179&lt;br /&gt;180&lt;br /&gt;181&lt;br /&gt;182&lt;br /&gt;183&lt;br /&gt;184&lt;br /&gt;185&lt;br /&gt;186&lt;br /&gt;187&lt;br /&gt;188&lt;br /&gt;189&lt;br /&gt;190&lt;br /&gt;191&lt;br /&gt;192&lt;br /&gt;193&lt;br /&gt;194&lt;br /&gt;195&lt;br /&gt;196&lt;br /&gt;197&lt;br /&gt;198&lt;br /&gt;199&lt;br /&gt;200&lt;br /&gt;201&lt;br /&gt;202&lt;br /&gt;203&lt;br /&gt;204&lt;br /&gt;205&lt;br /&gt;206&lt;br /&gt;207&lt;br /&gt;208&lt;br /&gt;209&lt;br /&gt;210&lt;br /&gt;211&lt;br /&gt;212&lt;br /&gt;213&lt;br /&gt;214&lt;br /&gt;215&lt;br /&gt;216&lt;br /&gt;217&lt;br /&gt;218&lt;br /&gt;219&lt;br /&gt;220&lt;br /&gt;221&lt;br /&gt;222&lt;br /&gt;223&lt;br /&gt;224&lt;br /&gt;225&lt;br /&gt;226&lt;br /&gt;227&lt;br /&gt;228&lt;br /&gt;229&lt;br /&gt;230&lt;br /&gt;231&lt;br /&gt;232&lt;br /&gt;233&lt;br /&gt;234&lt;br /&gt;235&lt;br /&gt;236&lt;br /&gt;237&lt;br /&gt;238&lt;br /&gt;239&lt;br /&gt;    &lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;    &lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/*&amp;nbsp;=================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;Arduino&amp;nbsp;Beatbox&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;9th&amp;nbsp;April&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Arduino&amp;nbsp;IDE:&amp;nbsp;1.6.2&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;This&amp;nbsp;project&amp;nbsp;uses&amp;nbsp;home&amp;nbsp;made&amp;nbsp;capacitive&amp;nbsp;sensors&amp;nbsp;to&amp;nbsp;trigger&amp;nbsp;over&amp;nbsp;130&amp;nbsp;MP3&amp;nbsp;sounds&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on&amp;nbsp;the&amp;nbsp;Grove&amp;nbsp;Serial&amp;nbsp;MP3&amp;nbsp;player.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;ADCTouch&amp;nbsp;library&amp;nbsp;is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;eliminate&amp;nbsp;the&amp;nbsp;resistors&amp;nbsp;from&amp;nbsp;the&amp;nbsp;Capacitive&amp;nbsp;sensing&amp;nbsp;circuit.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;code&amp;nbsp;used&amp;nbsp;for&amp;nbsp;capacitive&amp;nbsp;sensing&amp;nbsp;was&amp;nbsp;adapted&amp;nbsp;from&amp;nbsp;the&amp;nbsp;ADCTouch&amp;nbsp;library&amp;nbsp;example&amp;nbsp;sketches.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You&amp;nbsp;can&amp;nbsp;find&amp;nbsp;the&amp;nbsp;ADCTouch&amp;nbsp;library&amp;nbsp;and&amp;nbsp;relevant&amp;nbsp;example&amp;nbsp;code&amp;nbsp;here:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;http://playground.arduino.cc/Code/ADCTouch&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&quot;Advanced&amp;nbsp;Arduino&amp;nbsp;ADC&quot;&amp;nbsp;is&amp;nbsp;used&amp;nbsp;to&amp;nbsp;improve&amp;nbsp;the&amp;nbsp;analogRead()&amp;nbsp;speed,&amp;nbsp;and&amp;nbsp;enhance&amp;nbsp;the&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;drum&amp;nbsp;pad&amp;nbsp;or&amp;nbsp;capacitive&amp;nbsp;sensor&amp;nbsp;response&amp;nbsp;time.&amp;nbsp;The&amp;nbsp;Advanced&amp;nbsp;Arduino&amp;nbsp;ADC&amp;nbsp;code&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;was&amp;nbsp;adapted&amp;nbsp;from&amp;nbsp;this&amp;nbsp;site:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;http://www.microsmart.co.za/technical/2014/03/01/advanced-arduino-adc/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;===================================================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;#include&amp;nbsp;&amp;lt;&lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.h&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;#include&amp;nbsp;&amp;lt;&lt;span style=&quot;color: #CC6600;&quot;&gt;SoftwareSerial&lt;/span&gt;.h&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Global variables&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; potPin = A4;                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Grove Sliding potentiometer is connected to Analog Pin 4&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; potVal = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; mp3Vol = 0;                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Variable used to control the volume of the MP3 player&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; oldVol = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; buttonPin = 5;                         &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Grove Button is connected to Digital Pin 5&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; buttonStatus = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; SongNum[4] = {0x01,0x02,0x03,0x04};  &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//The first 4 songs will be assigned to the drum pads upon initialisation&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; numOfSongs = 130;                    &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Total number of MP3 songs/sounds loaded onto the SDHC card&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;long&lt;/span&gt; randNumber;                          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Variable used to hold the random number - used to randomise the sounds.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; ledState[4];                          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Used to keep track of the status of all LEDs (on or off)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; counter = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;SoftwareSerial&lt;/span&gt; mp3(3, 4);                 &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// The Grove MP3 Player is connected to Arduino digital Pin 3 and 4 (Serial communication)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; ref0, ref1, ref2, ref3;               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//reference values to remove offset&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; threshold = 100;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Define the ADC prescalers&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;char&lt;/span&gt; PS_64 = (1 &amp;lt;&amp;lt; ADPS2) | (1 &amp;lt;&amp;lt; ADPS1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;char&lt;/span&gt; PS_128 = (1 &amp;lt;&amp;lt; ADPS2) | (1 &amp;lt;&amp;lt; ADPS1) | (1 &amp;lt;&amp;lt; ADPS0);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Setup()&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;setup&lt;/b&gt;&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Initialise the Grove MP3 Module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(2500);                              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Allow the MP3 module to power up        &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;begin&lt;/span&gt;(9600);                          &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Begin Serial communication with the MP3 module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setPlayMode(0x00);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//0x00 = Single song - played once ie. not repeated.  (default)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Define the Grove Button as an INPUT&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(buttonPin, &lt;span style=&quot;color: #006699;&quot;&gt;INPUT&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Define the 4 LED Pins as OUTPUTs&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(8, &lt;span style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;);                       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Green LED&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(9, &lt;span style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;);                       &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Blue LED&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(10, &lt;span style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;);                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Red LED&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(11, &lt;span style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;);                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Yellow LED&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Make sure each LED is OFF, and store the state of the LED into a variable.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; i=8;i&amp;lt;12;i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(i, &lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledState[i-8]=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Double our clock speed from 125 kHz to 250 kHz&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ADCSRA&amp;nbsp;&amp;amp;=&amp;nbsp;~PS_128;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// set up the ADC&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ADCSRA&amp;nbsp;|=&amp;nbsp;PS_64;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// set our own prescaler to 64 &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Create reference values to account for the capacitance of each pad.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ref0&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A0, 500);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ref1&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A1, 500);      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Take 500 readings&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ref2&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A2, 500);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ref3&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A3, 500);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//This helps to randomise the drum pads.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;randomSeed&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;analogRead&lt;/span&gt;(0));&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Loop()&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================     &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;loop&lt;/b&gt;&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Take a reading from the Grove Sliding Potentiometer, and set volume accordingly&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;potVal&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;analogRead&lt;/span&gt;(potPin);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mp3Vol&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;map&lt;/span&gt;(potVal, 0, 1023, 0,31);              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Convert the potentometer reading (0 - 1023) to fit within the MP3 player&#39;s Volume range (0 - 31)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;((mp3Vol&amp;gt;(oldVol+1))|(mp3Vol&amp;lt;(oldVol-1))){      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Only make a change to the Volume on the Grove MP3 player when the potentiometer value changes&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oldVol&amp;nbsp;=&amp;nbsp;mp3Vol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setVolume(mp3Vol);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(10);                                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This delay is necessary with Serial communication to MP3 player&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Take a reading from the Pin attached to the Grove Button. If pressed, randomise the MP3 songs/sounds for each drum pad, and make the LEDs blink randomly.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;buttonStatus&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalRead&lt;/span&gt;(buttonPin);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(buttonStatus==&lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SongNum[0]=randomSongChooser(1,&amp;nbsp;30);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SongNum[1]=randomSongChooser(31,&amp;nbsp;60);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SongNum[2]=randomSongChooser(61,&amp;nbsp;86);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SongNum[3]=randomSongChooser(87,&amp;nbsp;(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt;)numOfSongs);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;randomLEDBlink();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Get the capacitive readings from each drum pad: 50 readings are taken from each pad. (default is 100) &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; value0 = &lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A0,50);        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//  Green drum pad&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; value1 = &lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A1,50);        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//   Blue drum pad&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; value2 = &lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A2,50);        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//    Red drum pad&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; value3 = &lt;span style=&quot;color: #CC6600;&quot;&gt;ADCTouch&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;(A3,50);        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Yellow drum pad&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Remove the offset to account for the baseline capacitance of each pad.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value0&amp;nbsp;-=&amp;nbsp;ref0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value1&amp;nbsp;-=&amp;nbsp;ref1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value2&amp;nbsp;-=&amp;nbsp;ref2;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value3&amp;nbsp;-=&amp;nbsp;ref3;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//If any of the values exceed the designated threshold, then play the song/sound associated with that drum pad.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//The associated LED will stay on for the whole time the drum pad is pressed, providing the value remains above the threshold. &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//The LED will turn off when the pad is not being touched or pressed.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(value0&amp;gt;threshold){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(8, &lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playSong(00,SongNum[0]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(8,&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(value1&amp;gt;threshold){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(9, &lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playSong(00,SongNum[1]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(9,&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(value2&amp;gt;threshold){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(10, &lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playSong(00,SongNum[2]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(10,&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(value3&amp;gt;threshold){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(11, &lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playSong(00,SongNum[3]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(11,&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// writeToMP3: &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// a generic function that simplifies each of the methods used to control the Grove MP3 Player&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; writeToMP3(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; MsgLEN, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; A, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; B, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; C, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; D, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; E, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; F){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; codeMsg[] = {MsgLEN, A,B,C,D,E,F};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x7E);                        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Start Code for every command = 0x7E&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; i = 0; i&amp;lt;MsgLEN+1; i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(codeMsg[i]);                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Send the rest of the command to the GROVE MP3 player&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//setPlayMode: defines how each song is to be played&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; setPlayMode(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; playMode){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/* playMode options:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x00&amp;nbsp;=&amp;nbsp;Single&amp;nbsp;song&amp;nbsp;-&amp;nbsp;played&amp;nbsp;only&amp;nbsp;once&amp;nbsp;ie.&amp;nbsp;not&amp;nbsp;repeated.&amp;nbsp;&amp;nbsp;(default)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x01&amp;nbsp;=&amp;nbsp;Single&amp;nbsp;song&amp;nbsp;-&amp;nbsp;cycled&amp;nbsp;ie.&amp;nbsp;repeats&amp;nbsp;over&amp;nbsp;and&amp;nbsp;over.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x02&amp;nbsp;=&amp;nbsp;All&amp;nbsp;songs&amp;nbsp;-&amp;nbsp;cycled&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x03&amp;nbsp;=&amp;nbsp;play&amp;nbsp;songs&amp;nbsp;randomly&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;writeToMP3(0x03,&amp;nbsp;0xA9,&amp;nbsp;playMode,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//playSong: tells the Grove MP3 player to play the song/sound, and also which song/sound to play&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; playSong(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; songHbyte, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; songLbyte){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;writeToMP3(0x04,&amp;nbsp;0xA0,&amp;nbsp;songHbyte,&amp;nbsp;songLbyte,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(100);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//setVolume: changes the Grove MP3 player&#39;s volume to the designated level (0 to 31)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; setVolume(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; Volume){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; tempVol = &lt;span style=&quot;color: #CC6600;&quot;&gt;constrain&lt;/span&gt;(Volume, 0, 31);             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Volume range = 00 (muted) to 31 (max volume)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;writeToMP3(0x03,&amp;nbsp;0xA7,&amp;nbsp;tempVol,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//randomSongChooser: chooses a random song to play. The range of songs to choose from&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//is limited and defined by the startSong and endSong parameters.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; randomSongChooser(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; startSong, &lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; endSong){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;randNumber&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;random&lt;/span&gt;(startSong, endSong);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt;) randNumber);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//randomLEDBlink: makes each LED blink randomly. The LEDs are attached to digital pins 8 to 12.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; randomLEDBlink(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;counter=8;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; i=0; i&amp;lt;40; i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; x = &lt;span style=&quot;color: #CC6600;&quot;&gt;constrain&lt;/span&gt;((&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt;)&lt;span style=&quot;color: #CC6600;&quot;&gt;random&lt;/span&gt;(8,12),8,12);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;toggleLED(x);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;random&lt;/span&gt;(50,100-i));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; i=8;i&amp;lt;12;i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(i, &lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(1000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; i=8;i&amp;lt;12;i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(i, &lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledState[i-8]=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//toggleLED: is used by the randomLEDBlink method to turn each LED on and off (randomly).&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//===================================================================================================&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; toggleLED(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; pinNum){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ledState[pinNum-8]=&amp;nbsp;!ledState[pinNum-8];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalWrite&lt;/span&gt;(pinNum, ledState[pinNum-8]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;    &lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;  &lt;P&gt; &lt;h4&gt;Arduino Code Discussion&lt;/h4&gt;  You can see from the Arduino code above, that it uses the &lt;a href=&quot;http://playground.arduino.cc/Code/ADCTouch&quot;&gt;ADCTouch library&lt;/a&gt;. This library was chosen over   the &lt;a href=&quot;http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense&quot;&gt;Capacitive Sensing Library&lt;/a&gt;  to eliminate the need for a high value resistor which are commonly found in Capacitive Sensing projects).         &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;        To increase the speed of the Analog readings, I utilised one of the &quot;Advanced Arduino ADC&quot; techniques described by         &lt;a href=&quot;http://www.microsmart.co.za/technical/2014/03/01/advanced-arduino-adc/&quot;&gt;Guy van den Berg on this Microsmart website&lt;/a&gt;.         &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;        The readings are increased by modifying the Arduino&#39;s ADC clock speed from 125kHz to 250 kHz. I did notice an overall better         response time with this modification. However, the Grove Serial MP3 player is limited by it&#39;s inability to play more than one         song or sound at a time. This means that if you hit another drum pad while the current sound is playing, it will stop playing the current sound,         and then play the selected sound. The speed at which it can perform this task was quite impressive. In fact it was much better         than I thought it would be. But if you are looking for polyphonic playability, you will be dissapointed.         &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;     This Serial MP3 module makes use of a high quality MP3 audio chip known as the &quot;WT5001&quot;. Therefore, you should be able to get some additional features and functionality         from &lt;a href=&quot;http://goo.gl/ai6oQ9&quot;&gt;this document&lt;/a&gt;. Plus you may find some extra useful info from &lt;a href=&quot;http://goo.gl/xOiSCl&quot;&gt;the Seeedstudio wiki&lt;/a&gt;.         I have re-used some code from the &lt;a href=&quot;http://arduinobasics.blogspot.com.au/2015/03/arduino-boombox.html&quot;&gt;Arduino Boombox tutorial&lt;/a&gt;... you will find extra Grove Serial MP3 functions on that page.         &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;     I will warn you... the Grove Serial MP3 player can play WAV files, however for some reason it would not play many of the         sound files in this format. Once the sounds were converted to the MP3 format, I did not look back.         So if you decide to take on this project, make sure your sound files are in MP3 format, you&#39;ll have a much better outcome.         &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;        I decided to introduce a random sound selection for each drum pad to extend the novelty of this instrument, which meant that         I had to come up with a fancy way to illuminate the LEDs. I demonstrated some of my other LED sequences         on my &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;instagram account&lt;/a&gt;. I sometimes use instagram to show my work in progress.         &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;        Have a look at the video below to see this project in action, and putting the Grove Serial MP3 player through it&#39;s paces.      &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;    &lt;P&gt;   &lt;H4&gt;The Video&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div style=&quot;text-align: center;&quot;&gt;   &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;        &lt;iframe width=&quot;640&quot; height=&quot;480&quot; src=&quot;https://www.youtube.com/embed/gdMAkTz4fy4&quot; frameborder=&quot;1&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/br&gt;         &lt;/div&gt;  &lt;/div&gt; &lt;/P&gt;&lt;/div&gt;&lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;P&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;  First there was the &lt;a href=&quot;http://arduinobasics.blogspot.com.au/2015/03/arduino-boombox.html&quot;&gt;Arduino Boombox&lt;/a&gt;, and now we have the Arduino Beatbox..... who knows what will come next !         &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;        Whenever I create a new project, I like to improve my Arduino knowledge. Sometimes it takes me into some         rather complicated topics. There is a lot I do not know about Arduino, but I am enjoying the journey. I hope you are too !!         Please Google plus one this post if it helped you in any way. These tutorials are free,         which means I survive on feedback and plus ones... all you have to do is just scroll a little bit more         and click that button :)         &lt;/div&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div align=&quot;center&quot;&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;   &lt;a href=&quot;http://arduino.cc/&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi52H6GdTRzTX9cfRSD10MbWFSUAHD6T2I78Z5_yyxqZVXvaX3sQtkLPQciWtwVVYjiangCNpF8lIDIIsmRlqwgmo0o4PeqocukyXp6GaBFWPbbrE2Oc0SKdgGsi717gzOPnsyt7MHKcRs/s1600/ArduinoLogo.png&quot; /&gt;&lt;/a&gt;  &lt;/div&gt; &lt;/div&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/3255297670382160582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/04/arduino-beatbox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/3255297670382160582'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/3255297670382160582'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/04/arduino-beatbox.html' title='Arduino BeatBox'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_MJXQQz8Upc7se50RFqLFZCXeMr6NS3i-E5pj4c77RmXJME73vmv4VDWnIFmgWK1dCJ3b_JZT7tdp8qHVZFmjYku8Rxi6WAhQlflufxVXQYi0DQwGJsjZ6TTvn4liWGyAk_FZFYN1Nxk/s72-c/Slide1.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-4718365267349042385</id><published>2015-04-08T17:31:00.000+07:00</published><updated>2018-03-28T22:35:15.366+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="LLC"/><category scheme="http://www.blogger.com/atom/ns#" term="poll"/><category scheme="http://www.blogger.com/atom/ns#" term="SRL"/><title type='text'>Arduino vs Arduino</title><content type='html'>&lt;span style=&quot;font-size: large;&quot;&gt;What side do you support?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The form submission is anonymous.&lt;br /&gt;I will post the results on Google+ around the 14th of April 2015.&lt;br /&gt;&lt;br /&gt;Make your choice below:&lt;br /&gt;&lt;iframe frameborder=&quot;0&quot; height=&quot;700&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; src=&quot;https://docs.google.com/forms/d/1Ab0weGaoDUFD-8Xnw2Cu7wmyMB-eTA-g-iutp7A1CxQ/viewform?embedded=true&quot; width=&quot;100%&quot;&gt;Loading...&lt;/iframe&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOGd1QyqKWyt1gPyNJbzuM4DVuN9kp7mNMrFaUTXrNLeVsLO651iOc2d-02bSO_9pgJecDREnr6_blHqrh-GBSUjvaC3WlU8hrm2Bx23dG76l8yp-1NEP4AMv-ka92ntcdY-fw-iCiN74/s1600/ArduinoSplit2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOGd1QyqKWyt1gPyNJbzuM4DVuN9kp7mNMrFaUTXrNLeVsLO651iOc2d-02bSO_9pgJecDREnr6_blHqrh-GBSUjvaC3WlU8hrm2Bx23dG76l8yp-1NEP4AMv-ka92ntcdY-fw-iCiN74/s1600/ArduinoSplit2.png&quot; height=&quot;15&quot; width=&quot;32&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/4718365267349042385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/04/arduino-vs-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4718365267349042385'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4718365267349042385'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/04/arduino-vs-arduino.html' title='Arduino vs Arduino'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOGd1QyqKWyt1gPyNJbzuM4DVuN9kp7mNMrFaUTXrNLeVsLO651iOc2d-02bSO_9pgJecDREnr6_blHqrh-GBSUjvaC3WlU8hrm2Bx23dG76l8yp-1NEP4AMv-ka92ntcdY-fw-iCiN74/s72-c/ArduinoSplit2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-6667696437279983996</id><published>2015-03-19T20:20:00.000+07:00</published><updated>2018-03-28T22:35:15.456+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ArduinoBasics"/><category scheme="http://www.blogger.com/atom/ns#" term="best arduino blog"/><category scheme="http://www.blogger.com/atom/ns#" term="Boombox"/><category scheme="http://www.blogger.com/atom/ns#" term="button"/><category scheme="http://www.blogger.com/atom/ns#" term="Grove"/><category scheme="http://www.blogger.com/atom/ns#" term="module"/><category scheme="http://www.blogger.com/atom/ns#" term="MP3"/><category scheme="http://www.blogger.com/atom/ns#" term="Player"/><category scheme="http://www.blogger.com/atom/ns#" term="Portable"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="Seeed Studio"/><category scheme="http://www.blogger.com/atom/ns#" term="SeeedStudio"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial"/><category scheme="http://www.blogger.com/atom/ns#" term="Sliding potentiometer"/><category scheme="http://www.blogger.com/atom/ns#" term="Sound"/><category scheme="http://www.blogger.com/atom/ns#" term="switch"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Arduino Boombox</title><content type='html'>&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &lt;P&gt;  &lt;!-- Title Page Graphic Arduino BoomBox Title Page Graphic--&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;img style=&quot;border:3px solid white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzFscsDNWo51pKZpXp6JEWhsoEW0wCGZuZBtVvSVcvkPw0hDxygbjWHjFXwWXor-RSziJE5CrdymMPzi3g-_bEXvmW6GZ_B3pEWh1ka3XOZnH5q758RwTtSLo48wxfIsL6c0fdjs0izDw/s1600/Arduino+BoomBox+Web+Title2.png&quot; height=&quot;152&quot; width=&quot;665&quot; /&gt;        &lt;/div&gt; &lt;/P&gt; &lt;P&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;   &lt;P&gt;    &lt;!-- Description and Introduction of project --&gt;    Add sound or music to your project using the &quot;Grove Serial MP3 Player&quot;.             &lt;/P&gt;            &lt;P&gt;                An Arduino UNO will be used to control the Grove Serial MP3 player by sending it specific serial commands. The Grove Base Shield allows for the easy connection of Grove sensor modules to an Arduino UNO without the need for a breadboard.                 A sliding potentiometer, switch and button will be connected to the Base shield along with the Serial MP3 player.                 A specific function will be assigned to each of the connected sensor modules to provide a useful interface:                  &lt;ul&gt;                &lt;li&gt;&lt;span style=&quot;color: yellow;&quot;&gt;Sliding Potentiometer&lt;/span&gt; – Volume control&lt;/li&gt;                &lt;li&gt;&lt;span style=&quot;color: yellow;&quot;&gt;Button&lt;/span&gt; – Next Song&lt;/li&gt;                &lt;li&gt;&lt;span style=&quot;color: yellow;&quot;&gt;Switch&lt;/span&gt; – On/Off (toggle)&lt;/li&gt;                &lt;/ul&gt;                 Once the MP3 module is working the way we want, we can then build a simple enclosure for it. &lt;/br&gt;                Grab a shoe-box, print out your favourite design, and make your very own Arduino BOOMBOX!    &lt;/P&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Video&lt;/H4&gt;  Watch the following video to see the project in action   &lt;BR /&gt;&amp;nbsp;      &lt;BR /&gt;  &lt;!-- VIDEO GOES HERE --&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;    &lt;iframe width=&quot;640&quot; height=&quot;480&quot; src=&quot;https://www.youtube.com/embed/VDRPnEpTKPk&quot; frameborder=&quot;1&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/br&gt;     &lt;/div&gt;    &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Parts Required:&lt;/H4&gt;  &lt;P&gt;   &lt;ul&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Freetronics-Eleven-100-Arduino-Uno-Compatible-p/ard-1002.htm&quot;&gt;Arduino UNO or compatible board&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Base-Shield-v1-3-p/sld01099p.htm&quot;&gt;Grove Base Shield&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Serial-MP3-Player-p/sen01300p.htm&quot;&gt;Grove Serial MP3 Player&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Switch-P-p/com08213p.htm&quot;&gt;Grove Switch (P)&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Slide-Potentiometer-p/com05231p.htm&quot;&gt;Grove Sliding Potentiometer&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Button-p/com22242p.htm&quot;&gt;Grove Button&lt;/a&gt; or &lt;a href=&quot;http://www.epictinker.com/Grove-Button-P-p/com08211p.htm&quot;&gt;Grove Button (P)&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/Grove-Universal-4-Pin-20cm-Cable-5pk-p/acc11317o.htm&quot;&gt;Grove Universal 4 pin cables&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://www.epictinker.com/6xAA-Battery-Holder-with-DC-2-1mm-Power-Jack-p/fit0141.htm&quot;&gt;Battery Holder&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://bit.ly/1H4UHXa&quot;&gt;SanDisk 8GB Ultra Micro SDHC Memory card&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href=&quot;http://lmgtfy.com/?q=DOSS+DS+1158&quot;&gt;Portable Powered Speaker&lt;/a&gt; or Headphones&lt;/li&gt;&lt;br /&gt;   &lt;/ul&gt;    Optional components (for the BoomBox Enclosure):    &lt;ul&gt;        &lt;li&gt;Empty Shoe Box&lt;/li&gt;        &lt;li&gt;Paper&lt;/li&gt;        &lt;li&gt;Printer&lt;/li&gt;        &lt;li&gt;Glue&lt;/li&gt;            &lt;/ul&gt;             If I had a 3D printer - I would have printed my own enclosure, but a shoebox seems to work just fine.   &lt;/P&gt; &lt;/P&gt;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Putting it Together&lt;/H4&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;   &lt;P&gt;Place the Grove Base shield onto the Arduino UNO,&lt;br&gt; and then connect each of the Grove Modules as per the table below.             &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;       &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;                    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKu9TI5JocWFYMsIsS-RdL38zodqui8f-Q5TDMawAZjypDqct_OgrE9sNlsOSA1yZo5rySNZ6W2pbC2Y9IscRF86n3Vyh267wDrhtrmFFEjMxU3Kg19oPO9w8mOtXwuAw38r4P8xHVXsM/s1600/Slide19.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                        &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKu9TI5JocWFYMsIsS-RdL38zodqui8f-Q5TDMawAZjypDqct_OgrE9sNlsOSA1yZo5rySNZ6W2pbC2Y9IscRF86n3Vyh267wDrhtrmFFEjMxU3Kg19oPO9w8mOtXwuAw38r4P8xHVXsM/s1600/Slide19.PNG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;                    &lt;/a&gt;                &lt;/div&gt;   &lt;/P&gt;   &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;            &lt;P&gt;If you do not have a Grove Base shield,&lt;br&gt; you can still connect the modules directly to the Arduino as per the table below:             &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;                &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;                    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE7pmCwyllAdmH3jIjG48VD5lbivhNecClDSDAM8aqBnuVty3Ljzn1rAndZY2IMqiI2vpcd7H-Cap8ZjLYO_CA2yg5Rndk8lQ2G6OT0fjqsb5R0-30KPT6rHswK4aQButTLHkrcdrhslU/s1600/Slide24.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                        &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE7pmCwyllAdmH3jIjG48VD5lbivhNecClDSDAM8aqBnuVty3Ljzn1rAndZY2IMqiI2vpcd7H-Cap8ZjLYO_CA2yg5Rndk8lQ2G6OT0fjqsb5R0-30KPT6rHswK4aQButTLHkrcdrhslU/s1600/Slide24.PNG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;                    &lt;/a&gt;                &lt;/div&gt;            &lt;/P&gt;            &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;            &lt;P&gt;When you are finished connecting the modules, it should look something like this:&lt;br&gt;            &amp;nbsp;&amp;nbsp;(ignore the battery pack):             &lt;BR /&gt;&amp;nbsp;             &lt;BR /&gt;                &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;                    &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgStxOzdQZGknTUmH8oHSjkBiyICkD-XFRaap6sjV4buaTA8p-OlWVVR2Z490y-XvtnyojZAF1Jq8LL1e5rmCt3acYTTb2U-CyDvvaZAlw5lxCvu_2BB9I-QQkXlTFFCVrYbhIm1TjYDzE/s1600/IMG_4425.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                        &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgStxOzdQZGknTUmH8oHSjkBiyICkD-XFRaap6sjV4buaTA8p-OlWVVR2Z490y-XvtnyojZAF1Jq8LL1e5rmCt3acYTTb2U-CyDvvaZAlw5lxCvu_2BB9I-QQkXlTFFCVrYbhIm1TjYDzE/s1600/IMG_4425.JPG&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;                    &lt;/a&gt;                &lt;/div&gt;            &lt;/P&gt;            &lt;P&gt;As you can see from the picture above. You can cut holes out of the shoebox and stick the modules in place.                Please ignore the battery pack, because you won&#39;t use it until after you have uploaded the Arduino code.             &lt;/P&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;P&gt;  &lt;H4&gt;Arduino Sketch&lt;/H4&gt;  &lt;BR /&gt;&amp;nbsp;   &lt;div style=&quot;background: #ffffff; color: #000000; overflow:auto;width:auto;border:solid rgb(24,186,183);border-width: .6em .3em .3em .3em;padding: 0em 0em;&quot;&gt;      &lt;table&gt;       &lt;tr&gt;        &lt;td&gt;         &lt;pre style=&quot;margin: 0; line-height: 125%; background: rgb(24,186,183); width: 1.9em&quot;&gt;  1&lt;br /&gt;  2&lt;br /&gt;  3&lt;br /&gt;  4&lt;br /&gt;  5&lt;br /&gt;  6&lt;br /&gt;  7&lt;br /&gt;  8&lt;br /&gt;  9&lt;br /&gt; 10&lt;br /&gt; 11&lt;br /&gt; 12&lt;br /&gt; 13&lt;br /&gt; 14&lt;br /&gt; 15&lt;br /&gt; 16&lt;br /&gt; 17&lt;br /&gt; 18&lt;br /&gt; 19&lt;br /&gt; 20&lt;br /&gt; 21&lt;br /&gt; 22&lt;br /&gt; 23&lt;br /&gt; 24&lt;br /&gt; 25&lt;br /&gt; 26&lt;br /&gt; 27&lt;br /&gt; 28&lt;br /&gt; 29&lt;br /&gt; 30&lt;br /&gt; 31&lt;br /&gt; 32&lt;br /&gt; 33&lt;br /&gt; 34&lt;br /&gt; 35&lt;br /&gt; 36&lt;br /&gt; 37&lt;br /&gt; 38&lt;br /&gt; 39&lt;br /&gt; 40&lt;br /&gt; 41&lt;br /&gt; 42&lt;br /&gt; 43&lt;br /&gt; 44&lt;br /&gt; 45&lt;br /&gt; 46&lt;br /&gt; 47&lt;br /&gt; 48&lt;br /&gt; 49&lt;br /&gt; 50&lt;br /&gt; 51&lt;br /&gt; 52&lt;br /&gt; 53&lt;br /&gt; 54&lt;br /&gt; 55&lt;br /&gt; 56&lt;br /&gt; 57&lt;br /&gt; 58&lt;br /&gt; 59&lt;br /&gt; 60&lt;br /&gt; 61&lt;br /&gt; 62&lt;br /&gt; 63&lt;br /&gt; 64&lt;br /&gt; 65&lt;br /&gt; 66&lt;br /&gt; 67&lt;br /&gt; 68&lt;br /&gt; 69&lt;br /&gt; 70&lt;br /&gt; 71&lt;br /&gt; 72&lt;br /&gt; 73&lt;br /&gt; 74&lt;br /&gt; 75&lt;br /&gt; 76&lt;br /&gt; 77&lt;br /&gt; 78&lt;br /&gt; 79&lt;br /&gt; 80&lt;br /&gt; 81&lt;br /&gt; 82&lt;br /&gt; 83&lt;br /&gt; 84&lt;br /&gt; 85&lt;br /&gt; 86&lt;br /&gt; 87&lt;br /&gt; 88&lt;br /&gt; 89&lt;br /&gt; 90&lt;br /&gt; 91&lt;br /&gt; 92&lt;br /&gt; 93&lt;br /&gt; 94&lt;br /&gt; 95&lt;br /&gt; 96&lt;br /&gt; 97&lt;br /&gt; 98&lt;br /&gt; 99&lt;br /&gt;100&lt;br /&gt;101&lt;br /&gt;102&lt;br /&gt;103&lt;br /&gt;104&lt;br /&gt;105&lt;br /&gt;106&lt;br /&gt;107&lt;br /&gt;108&lt;br /&gt;109&lt;br /&gt;110&lt;br /&gt;111&lt;br /&gt;112&lt;br /&gt;113&lt;br /&gt;114&lt;br /&gt;115&lt;br /&gt;116&lt;br /&gt;117&lt;br /&gt;118&lt;br /&gt;119&lt;br /&gt;120&lt;br /&gt;121&lt;br /&gt;122&lt;br /&gt;123&lt;br /&gt;124&lt;br /&gt;125&lt;br /&gt;126&lt;br /&gt;127&lt;br /&gt;128&lt;br /&gt;129&lt;br /&gt;130&lt;br /&gt;131&lt;br /&gt;132&lt;br /&gt;133&lt;br /&gt;134&lt;br /&gt;135&lt;br /&gt;136&lt;br /&gt;137&lt;br /&gt;138&lt;br /&gt;139&lt;br /&gt;140&lt;br /&gt;141&lt;br /&gt;142&lt;br /&gt;143&lt;br /&gt;144&lt;br /&gt;145&lt;br /&gt;146&lt;br /&gt;147&lt;br /&gt;148&lt;br /&gt;149&lt;br /&gt;150&lt;br /&gt;151&lt;br /&gt;152&lt;br /&gt;153&lt;br /&gt;154&lt;br /&gt;155&lt;br /&gt;156&lt;br /&gt;157&lt;br /&gt;158&lt;br /&gt;159&lt;br /&gt;160&lt;br /&gt;161&lt;br /&gt;162&lt;br /&gt;163&lt;br /&gt;164&lt;br /&gt;165&lt;br /&gt;166&lt;br /&gt;167&lt;br /&gt;168&lt;br /&gt;169&lt;br /&gt;170&lt;br /&gt;171&lt;br /&gt;172&lt;br /&gt;173&lt;br /&gt;174&lt;br /&gt;175&lt;br /&gt;176&lt;br /&gt;177&lt;br /&gt;178&lt;br /&gt;179&lt;br /&gt;180&lt;br /&gt;181&lt;br /&gt;182&lt;br /&gt;183&lt;br /&gt;184&lt;br /&gt;185&lt;br /&gt;186&lt;br /&gt;187&lt;br /&gt;188&lt;br /&gt;189&lt;br /&gt;190&lt;br /&gt;191&lt;br /&gt;192&lt;br /&gt;193&lt;br /&gt;    &lt;/pre&gt;   &lt;/td&gt;   &lt;td&gt;    &lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;br /&gt;    &lt;!-- INSERT ARDUINO CODE HERE  --&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/*&amp;nbsp;===============================================================================&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Project:&amp;nbsp;Grove&amp;nbsp;Serial&amp;nbsp;MP3&amp;nbsp;Player&amp;nbsp;overview&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author:&amp;nbsp;Scott&amp;nbsp;C&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Created:&amp;nbsp;9th&amp;nbsp;March&amp;nbsp;2015&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Arduino&amp;nbsp;IDE:&amp;nbsp;1.6.0&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Website:&amp;nbsp;http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;Description:&amp;nbsp;The&amp;nbsp;following&amp;nbsp;Arduino&amp;nbsp;sketch&amp;nbsp;will&amp;nbsp;allow&amp;nbsp;you&amp;nbsp;to&amp;nbsp;control&amp;nbsp;a&amp;nbsp;Grove&amp;nbsp;Serial&amp;nbsp;MP3&amp;nbsp;player&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;with&amp;nbsp;a&amp;nbsp;Grove&amp;nbsp;Sliding&amp;nbsp;Potentiometer&amp;nbsp;(volume),&amp;nbsp;a&amp;nbsp;Grove&amp;nbsp;button&amp;nbsp;(next&amp;nbsp;song),&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;and&amp;nbsp;a&amp;nbsp;Grove&amp;nbsp;Switch&amp;nbsp;(on/off).&amp;nbsp;It&amp;nbsp;will&amp;nbsp;also&amp;nbsp;show&amp;nbsp;you&amp;nbsp;how&amp;nbsp;to&amp;nbsp;retrieve&amp;nbsp;some&amp;nbsp;useful&amp;nbsp;information&amp;nbsp;from&amp;nbsp;the&amp;nbsp;player.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Some&amp;nbsp;functions&amp;nbsp;are&amp;nbsp;not&amp;nbsp;used&amp;nbsp;in&amp;nbsp;this&amp;nbsp;sketch,but&amp;nbsp;have&amp;nbsp;been&amp;nbsp;included&amp;nbsp;for&amp;nbsp;your&amp;nbsp;benefit.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Additional&amp;nbsp;features&amp;nbsp;and&amp;nbsp;functionality&amp;nbsp;can&amp;nbsp;be&amp;nbsp;found&amp;nbsp;on&amp;nbsp;the&amp;nbsp;WT5001&amp;nbsp;voice&amp;nbsp;chip&amp;nbsp;datasheet&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;which&amp;nbsp;I&amp;nbsp;retrieved&amp;nbsp;from&amp;nbsp;here:&amp;nbsp;http://goo.gl/ai6oQ9&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;Seeedstudio&amp;nbsp;wiki&amp;nbsp;was&amp;nbsp;a&amp;nbsp;very&amp;nbsp;useful&amp;nbsp;resource&amp;nbsp;for&amp;nbsp;getting&amp;nbsp;started&amp;nbsp;with&amp;nbsp;the&amp;nbsp;various&amp;nbsp;Grove&amp;nbsp;modules:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;http://goo.gl/xOiSCl&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;===============================================================================&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#include&amp;nbsp;&amp;lt;&lt;span style=&quot;color: #CC6600;&quot;&gt;SoftwareSerial&lt;/span&gt;.h&amp;gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;SoftwareSerial&lt;/span&gt; mp3(2, 3);      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// The Grove MP3 Player is connected to Arduino digital Pin 2 and 3 (Serial communication)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; potPin = A0;               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// The Sliding Potentiometer is connected to AnalogPin 0&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; potVal = 0;                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This is used to hold the value of the Sliding Potentiometer&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; mp3Vol = 0;               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// mp3Vol is used to calculate the Current volume of the Grove MP3 player&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; oldVol = 0;               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// oldVol is used to remember the previous volume level&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; ledPin = A1;               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// The Grove sliding potentiometer has an onboard LED attached to Analog pin 1.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; switchPin = 12;             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// The Grove Switch(P) is connected to digital Pin 12&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; switchStatus = 0;           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This is used to hold the status of the switch &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; switchChangeStatus = 0;     &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Used to identify when the switch status has changed&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; buttonPin = 5;              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// The Grove Button is connected to digital pin 5&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; buttonStatus = 0;           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This is used to hold the status of the button  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;setup&lt;/b&gt;&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Initialise the Grove MP3 Module&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(2500);&lt;br /&gt;&amp;nbsp;&amp;nbsp;mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;begin&lt;/span&gt;(9600);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// initialize the pushbutton and switch pin as an input:&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(buttonPin, &lt;span style=&quot;color: #006699;&quot;&gt;INPUT&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(switchPin, &lt;span style=&quot;color: #006699;&quot;&gt;INPUT&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// set ledPin on the sliding potentiometer to OUTPUT&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;pinMode&lt;/span&gt;(ledPin, &lt;span style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//You can view the following demostration output in the Serial Monitor&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;demonstrate_GET_FUNCTIONS();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;loop&lt;/b&gt;&lt;/span&gt;(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;switchStatus&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalRead&lt;/span&gt;(switchPin);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(switchStatus==&lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(switchChangeStatus==&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;){             &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// When Arduino detects a change in the switchStatus (from LOW to HIGH) - play song      &lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setPlayMode(0x02);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Automatically cycle to the next song when the current song ends&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playSong(00,01);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Play the 1st song when you switch it on&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switchChangeStatus=&lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;potVal&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;analogRead&lt;/span&gt;(potPin);                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Analog read values from the sliding potentiometer range from 0 to 1023&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;analogWrite&lt;/span&gt;(ledPin, potVal/4);                    &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Analog write values range from 0 to 255, and will turn LED ON once potentiometer reaches about half way (or more).&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mp3Vol&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;map&lt;/span&gt;(potVal, 0, 1023, 0,31);              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Convert the potentometer reading (0 - 1023) to fit within the MP3 player&#39;s Volume range (0 - 31)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;((mp3Vol&amp;gt;(oldVol+1))|(mp3Vol&amp;lt;(oldVol-1))){      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Only make a change to the Volume on the Grove MP3 player when the potentiometer value changes&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oldVol&amp;nbsp;=&amp;nbsp;mp3Vol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setVolume(mp3Vol);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(10);                               &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This delay is necessary with Serial communication to MP3 player&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;buttonStatus&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;digitalRead&lt;/span&gt;(buttonPin);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(buttonStatus==&lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;){                    &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// When a button press is detected - play the next song&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;playNextSong();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(200);                              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// This delay aims to prevent a &quot;skipped&quot; song due to slow button presses - can modify to suit.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;else&lt;/span&gt; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(switchChangeStatus==&lt;span style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;){              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// When switchStatus changes from HIGH to LOW - stop Song.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stopSong();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switchChangeStatus=&lt;span style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//&amp;nbsp;demonstrate_GET_FUNCTIONS&amp;nbsp;&amp;nbsp;will&amp;nbsp;show&amp;nbsp;you&amp;nbsp;how&amp;nbsp;to&amp;nbsp;retrieve&amp;nbsp;some&amp;nbsp;useful&amp;nbsp;information&amp;nbsp;from&amp;nbsp;the&amp;nbsp;Grove&amp;nbsp;MP3&amp;nbsp;Player&amp;nbsp;(using&amp;nbsp;the&amp;nbsp;Serial&amp;nbsp;Monitor).&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; demonstrate_GET_FUNCTIONS(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;begin&lt;/span&gt;(9600);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Volume: &quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(getVolume());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;Playing State: &quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(getPlayingState());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;print&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;# of Files in SD Card:&quot;&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(getNumberOfFiles());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;&lt;b&gt;Serial&lt;/b&gt;&lt;/span&gt;.&lt;span style=&quot;color: #CC6600;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #006699;&quot;&gt;&quot;------------------------------&quot;&lt;/span&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//&amp;nbsp;writeToMP3:&amp;nbsp;is&amp;nbsp;a&amp;nbsp;generic&amp;nbsp;function&amp;nbsp;that&amp;nbsp;aims&amp;nbsp;to&amp;nbsp;simplify&amp;nbsp;all&amp;nbsp;of&amp;nbsp;the&amp;nbsp;methods&amp;nbsp;that&amp;nbsp;control&amp;nbsp;the&amp;nbsp;Grove&amp;nbsp;MP3&amp;nbsp;Player&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; writeToMP3(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; MsgLEN, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; A, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; B, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; C, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; D, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; E, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; F){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; codeMsg[] = {MsgLEN, A,B,C,D,E,F};&lt;br /&gt;&amp;nbsp;&amp;nbsp;mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(0x7E);                        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Start Code for every command = 0x7E&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; i = 0; i&amp;lt;MsgLEN+1; i++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;write&lt;/span&gt;(codeMsg[i]);                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Send the rest of the command to the GROVE MP3 player&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/*&amp;nbsp;The&amp;nbsp;Following&amp;nbsp;functions&amp;nbsp;control&amp;nbsp;the&amp;nbsp;Grove&amp;nbsp;MP3&amp;nbsp;Player&amp;nbsp;:&amp;nbsp;see&amp;nbsp;datasheet&amp;nbsp;for&amp;nbsp;additional&amp;nbsp;functions--------------------------------------------*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; setPlayMode(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; playMode){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/* playMode options:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x00&amp;nbsp;=&amp;nbsp;Single&amp;nbsp;song&amp;nbsp;-&amp;nbsp;played&amp;nbsp;only&amp;nbsp;once&amp;nbsp;ie.&amp;nbsp;not&amp;nbsp;repeated.&amp;nbsp;&amp;nbsp;(default)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x01&amp;nbsp;=&amp;nbsp;Single&amp;nbsp;song&amp;nbsp;-&amp;nbsp;cycled&amp;nbsp;ie.&amp;nbsp;repeats&amp;nbsp;over&amp;nbsp;and&amp;nbsp;over.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x02&amp;nbsp;=&amp;nbsp;All&amp;nbsp;songs&amp;nbsp;-&amp;nbsp;cycled&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0x03&amp;nbsp;=&amp;nbsp;play&amp;nbsp;songs&amp;nbsp;randomly&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x03,&amp;nbsp;0xA9,&amp;nbsp;playMode,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&amp;nbsp;&amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; playSong(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; songHbyte, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; songLbyte){                              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Plays the selected song&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x04,&amp;nbsp;0xA0,&amp;nbsp;songHbyte,&amp;nbsp;songLbyte,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; pauseSong(){                                                           &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Pauses the current song&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x02,&amp;nbsp;0xA3,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; stopSong(){                                                            &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Stops the current song&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x02,&amp;nbsp;0xA4,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; playNextSong(){                                                        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Play the next song&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x02,&amp;nbsp;0xA5,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; playPreviousSong(){                                                    &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Play the previous song&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x02,&amp;nbsp;0xA6,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; addSongToPlayList(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; songHbyte, &lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; songLbyte){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Repeat this function for every song you wish to stack onto the playlist (max = 10 songs)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x04,&amp;nbsp;0xA8,&amp;nbsp;songHbyte,&amp;nbsp;songLbyte,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;void&lt;/span&gt; setVolume(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; Volume){                                                &lt;span style=&quot;color: #7E7E7E;&quot;&gt;// Set the volume&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; tempVol = &lt;span style=&quot;color: #CC6600;&quot;&gt;constrain&lt;/span&gt;(Volume, 0, 31);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Volume range = 00 (muted) to 31 (max volume)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x03,&amp;nbsp;0xA7,&amp;nbsp;tempVol,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&amp;nbsp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;/*&amp;nbsp;The&amp;nbsp;following&amp;nbsp;functions&amp;nbsp;retrieve&amp;nbsp;information&amp;nbsp;from&amp;nbsp;the&amp;nbsp;Grove&amp;nbsp;MP3&amp;nbsp;player&amp;nbsp;:&amp;nbsp;see&amp;nbsp;data&amp;nbsp;sheet&amp;nbsp;for&amp;nbsp;additional&amp;nbsp;functions--------------*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//&amp;nbsp;getData:&amp;nbsp;is&amp;nbsp;a&amp;nbsp;generic&amp;nbsp;function&amp;nbsp;to&amp;nbsp;simplifly&amp;nbsp;the&amp;nbsp;other&amp;nbsp;functions&amp;nbsp;for&amp;nbsp;retieving&amp;nbsp;information&amp;nbsp;from&amp;nbsp;the&amp;nbsp;Grove&amp;nbsp;Serial&amp;nbsp;MP3&amp;nbsp;player&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; getData(&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; queryVal, &lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; dataPosition){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; returnVal = 0x00;&lt;br /&gt;&amp;nbsp;&amp;nbsp;writeToMP3(0x02,&amp;nbsp;queryVal,&amp;nbsp;0x7E,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00,&amp;nbsp;0x00);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(50);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #CC6600;&quot;&gt;int&lt;/span&gt; x = 0; x&amp;lt;dataPosition; x++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;if&lt;/span&gt;(mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;available&lt;/span&gt;()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;returnVal&amp;nbsp;=&amp;nbsp;mp3.&lt;span style=&quot;color: #CC6600;&quot;&gt;read&lt;/span&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;delay&lt;/span&gt;(50);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(returnVal);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; getVolume(){                                              &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Get the volume of the Grove Serial MP3 player&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//returns value from 0 - 31&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(getData(0xC1, 4));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; getPlayingState(){                                        &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Get the playing state : Play / Stopped / Paused&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//returns 1: Play,   2: Stop,   3:Paused&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(getData(0xC2, 2));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #CC6600;&quot;&gt;byte&lt;/span&gt; getNumberOfFiles(){                                      &lt;span style=&quot;color: #7E7E7E;&quot;&gt;//Find out how many songs are on the SD card&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7E7E7E;&quot;&gt;//returns the number of MP3 files on SD card&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #CC6600;&quot;&gt;return&lt;/span&gt;(getData(0xC4, 3));&lt;br /&gt;}&lt;br /&gt;    &lt;!--         End of Arduino Code --&gt;&lt;br /&gt;    &lt;/pre&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/P&gt;  &lt;P&gt;  &lt;!-- Arduino Code Discussion --&gt;  &lt;div style=&quot;text-align: justify;&quot;&gt;    You will notice from the code, that I did not utilise every function. I decided to include them for your benifit.     This Serial MP3 module makes use of a high quality MP3 audio chip known as the &quot;WT5001&quot;. Therefore, you should be able to get some additional features and functionality           from &lt;a href=&quot;http://goo.gl/ai6oQ9&quot;&gt;this document&lt;/a&gt;. Plus you may find some extra useful info from &lt;a href=&quot;http://goo.gl/xOiSCl&quot;&gt;the Seeedstudio wiki&lt;/a&gt;.           &lt;BR /&gt;&amp;nbsp;           &lt;BR&gt;          &lt;span style=&quot;color: red;&quot;&gt;IMPORTANT:&lt;/span&gt; You need to load your MP3 sounds or songs onto the SDHC card before you install it onto the Serial MP3 player.           &lt;BR /&gt;&amp;nbsp;           &lt;BR&gt;          Once the SDHC card is installed, and your code is uploaded to the Arduino, all you have to do now is connect the MP3 player           to some headphones or a powered speaker. You can then power the Arduino and modules with a battery pack or some other portable power supply.           &lt;BR /&gt;&amp;nbsp;           &lt;BR&gt;          You can design and decorate the shoebox in any way you like. Just print out your picture, glue them on, and before you know it, you will have           your very own Arduino Boombox.           &lt;BR /&gt;&amp;nbsp;           &lt;BR&gt;          &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMLve96LtPUppc-s8RxM6ODka8YlrDaS0qEPWz-m_7lPU92j31HinLUdvubsW7QqRtuLAxnpefhPDsXuAezPwuL-gh9_gVem94GDF5Ez0g4YFwpTe-GtLAeEOZ41UFMlJ7QKwFcGvt0NA/s1600/BoomBox.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMLve96LtPUppc-s8RxM6ODka8YlrDaS0qEPWz-m_7lPU92j31HinLUdvubsW7QqRtuLAxnpefhPDsXuAezPwuL-gh9_gVem94GDF5Ez0g4YFwpTe-GtLAeEOZ41UFMlJ7QKwFcGvt0NA/s1600/BoomBox.png&quot; height=&quot;226&quot; width=&quot;400&quot; /&gt;            &lt;/a&gt;          &lt;/div&gt;  &lt;/div&gt;    &lt;/P&gt;&lt;/div&gt;&lt;!--separator --&gt;&lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;&lt;P&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;  &lt;!-- Concluding Comments --&gt;  &lt;h4&gt;Comments&lt;/h4&gt;  &lt;P&gt;I was very surprised by the quality of the sound that came from the MP3 module. It is actually quite good. &lt;/P&gt;  &lt;P&gt;  This tutorial was an introduction to the Grove Serial MP3 module in it&#39;s most basic form. You could just as easily use some other sensor to trigger the MP3 module.   For example, you could get it to play an alert if a water leak was detected, or if a door was opened, or if the temperature got too high or too low.   You could get it to play a reminder when you walk into your room. The possibilities are endless.&lt;/P&gt;        &lt;P&gt;I really liked this module, and I am sure it will appear in a future tutorial. &lt;/P&gt;        &lt;BR /&gt;&amp;nbsp;         &lt;BR&gt;        &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;            &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYzPbZz8QA4oWp3NTDq7QV1p1ygWBd840VmbAPsRI_hs9KGJx3k04FP4QgQ97aswbxQYK-Kf46ZKw0AFSiNQctsetHd7C1lsmuuE8K00yxgIx2t9G2HFa0bAmbXmbFo9xsxyDd11lGQME/s1600/Bear+Boombox.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;                &lt;img style=&quot;border:3px double white;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYzPbZz8QA4oWp3NTDq7QV1p1ygWBd840VmbAPsRI_hs9KGJx3k04FP4QgQ97aswbxQYK-Kf46ZKw0AFSiNQctsetHd7C1lsmuuE8K00yxgIx2t9G2HFa0bAmbXmbFo9xsxyDd11lGQME/s1600/Bear+Boombox.jpg&quot; height=&quot;300&quot; width=&quot;400&quot; /&gt;            &lt;/a&gt;        &lt;/div&gt;&lt;br /&gt; &lt;/div&gt; &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  &lt;div align=&quot;center&quot;&gt;   If you like this page, please do me a favour and show your appreciation : &lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br&gt;   &lt;BR /&gt;&amp;nbsp;    &lt;BR /&gt;   Visit my &lt;a href=&quot;https://plus.google.com/u/0/b/107402020974762902161/107402020974762902161/posts&quot;&gt;ArduinoBasics Google + page&lt;/a&gt;.&lt;br&gt;   Follow me on Twitter by looking for &lt;a href=&quot;https://twitter.com/ArduinoBasics&quot;&gt;ScottC @ArduinoBasics&lt;/a&gt;.&lt;br&gt;   I can also be found on &lt;a href=&quot;https://www.pinterest.com/ArduinoBasics/&quot;&gt;Pinterest&lt;/a&gt; and &lt;a href=&quot;https://instagram.com/arduinobasics&quot;&gt;Instagram&lt;/a&gt;. &lt;br&gt;   Have a look at my videos on my &lt;a href=&quot;https://www.youtube.com/user/ScottCMe/videos&quot;&gt;YouTube channel&lt;/a&gt;.&lt;br&gt;  &lt;/div&gt; &lt;/P&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div align=&quot;center&quot;&gt;  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;   &lt;a href=&quot;http://arduino.cc/&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi52H6GdTRzTX9cfRSD10MbWFSUAHD6T2I78Z5_yyxqZVXvaX3sQtkLPQciWtwVVYjiangCNpF8lIDIIsmRlqwgmo0o4PeqocukyXp6GaBFWPbbrE2Oc0SKdgGsi717gzOPnsyt7MHKcRs/s1600/ArduinoLogo.png&quot; /&gt;&lt;/a&gt;  &lt;/div&gt; &lt;/div&gt; &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;BR /&gt;&amp;nbsp;  &lt;div&gt;  &lt;P&gt;   &lt;!--separator --&gt;   &lt;img alt=&quot;&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; width=&quot;98%&quot; /&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/P&gt; &lt;/div&gt; &lt;P&gt;  However, if you do not have a google profile... &lt;br&gt;Feel free to share this page with your friends in any way you see fit.  &lt;/P&gt;&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- Blogger automated replacement: &quot;https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-XQiwNpdqOxk%2FT_rKCzDh4nI%2FAAAAAAAAAQY%2FOfYBljhU6Lk%2Fs1600%2FSeparator.jpg&amp;amp;container=blogger&amp;amp;gadget=a&amp;amp;rewriteMime=image%2F*&quot; with &quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQcPyeoVXT13ITWMxeXKmLdUaL7is2TgpLLFhVz4PEgs0yJGdgByK6O2Rbhd_CVRFmTmpjBiOr9Ku-5sbN_lr3jYYZTp9Qcdjyq9qNVKBqC_MI_0vuBsQTBlRC0deTKNxWwqT_LUXRXtw/s1600/Separator.jpg&quot; --&gt;</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/6667696437279983996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/03/arduino-boombox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/6667696437279983996'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/6667696437279983996'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/03/arduino-boombox.html' title='Arduino Boombox'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzFscsDNWo51pKZpXp6JEWhsoEW0wCGZuZBtVvSVcvkPw0hDxygbjWHjFXwWXor-RSziJE5CrdymMPzi3g-_bEXvmW6GZ_B3pEWh1ka3XOZnH5q758RwTtSLo48wxfIsL6c0fdjs0izDw/s72-c/Arduino+BoomBox+Web+Title2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-4786575903179636620</id><published>2015-03-13T15:52:00.004+07:00</published><updated>2015-03-13T16:07:45.357+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="samsung corby 2"/><category scheme="http://www.blogger.com/atom/ns#" term="tips &amp; trik"/><title type='text'>how to change Bluetooth MAC address in samsung corby 2 GT S3850</title><content type='html'>well ladies and gentleman in here i would like share for you all about &lt;b&gt;how to change Bluetooth MAC address in samsung corby 2 GT S3850&lt;/b&gt; well i found this tips &amp;amp; trick when i was try something like secret code for samsung corby 2. and in that, i found new secret code for samsung corby 2 to enter like command prompt. in there you can look many test, firmware version, test sound, test vibration, test bluetooth and wi-fi and still many again.&lt;br /&gt;
so.. in that when i enter the bluetooth test i found this tips or trick to change Bluetooth MAC address in samsung corby 2 GT S3850. but i have a dificult to change my bluetooth MAC address. yeah, i must know about hex or maybe assembly language for change my bluetooth address with number and alphabet i wont. because bluetooth MAC address just have 0-9 and A-F. OK if you was curious for &lt;b&gt;how to change Bluetooth MAC address in samsung corby 2 GT S3850&lt;/b&gt;. now see in below :&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB1Q3qLuEZk6oNDmcRM0uhJqIrwDGe_YIWGzaSFPCqINTkVKCkGH_71xDCuMOFwZ8UG9e9FHBs8sD95M98yY5_8-AXJLSAjmRIoZwDQDV4x8_diXsxPiYkvbBzp5tLXlQNi_MuYJVgKIms/s1600/20150313153139.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8fQ50tZ-WYgrE-AGIEUwR9bGTtIBvoP-y4uV3L3dL58pIKC5nj42W3E5eh8v4i0COAY-jpmkqu2k3PNBbFtDWnipiFY7QhcIIy9_ewb7E-RsbwBrE9wj6iJ2qmjB_ZKVAp_14UqQDLRHc/s1600/20150313153148.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;go to numpad or number keypad&amp;nbsp;&lt;/li&gt;
&lt;li&gt;enter this code *#0011#&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB1Q3qLuEZk6oNDmcRM0uhJqIrwDGe_YIWGzaSFPCqINTkVKCkGH_71xDCuMOFwZ8UG9e9FHBs8sD95M98yY5_8-AXJLSAjmRIoZwDQDV4x8_diXsxPiYkvbBzp5tLXlQNi_MuYJVgKIms/s1600/20150313153139.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB1Q3qLuEZk6oNDmcRM0uhJqIrwDGe_YIWGzaSFPCqINTkVKCkGH_71xDCuMOFwZ8UG9e9FHBs8sD95M98yY5_8-AXJLSAjmRIoZwDQDV4x8_diXsxPiYkvbBzp5tLXlQNi_MuYJVgKIms/s1600/20150313153139.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB1Q3qLuEZk6oNDmcRM0uhJqIrwDGe_YIWGzaSFPCqINTkVKCkGH_71xDCuMOFwZ8UG9e9FHBs8sD95M98yY5_8-AXJLSAjmRIoZwDQDV4x8_diXsxPiYkvbBzp5tLXlQNi_MuYJVgKIms/s1600/20150313153139.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt; &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;press back 6 times until showed like image in number 4 !&lt;/li&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;press number 2 or enter number 2 in colom and OK to view [2] Version Information ! &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8fQ50tZ-WYgrE-AGIEUwR9bGTtIBvoP-y4uV3L3dL58pIKC5nj42W3E5eh8v4i0COAY-jpmkqu2k3PNBbFtDWnipiFY7QhcIIy9_ewb7E-RsbwBrE9wj6iJ2qmjB_ZKVAp_14UqQDLRHc/s1600/20150313153148.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8fQ50tZ-WYgrE-AGIEUwR9bGTtIBvoP-y4uV3L3dL58pIKC5nj42W3E5eh8v4i0COAY-jpmkqu2k3PNBbFtDWnipiFY7QhcIIy9_ewb7E-RsbwBrE9wj6iJ2qmjB_ZKVAp_14UqQDLRHc/s1600/20150313153148.jpg&quot; /&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;press number 3 or enter number 3 in colom and OK to view [3] Bluetooth information !&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7ou42eouck6H2MboxOp05A0eRXDrNp8MWfCute4aNBnU-u5rgGu8ylreqYiYB6JDRcowxSnr6kuWc7MriI1qHwGjRHI7NDIz2hYrDQ98opBad8kAfwHKOtpfQr1rvxO9lkJFgCSpE4OsI/s1600/20150313153510.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7ou42eouck6H2MboxOp05A0eRXDrNp8MWfCute4aNBnU-u5rgGu8ylreqYiYB6JDRcowxSnr6kuWc7MriI1qHwGjRHI7NDIz2hYrDQ98opBad8kAfwHKOtpfQr1rvxO9lkJFgCSpE4OsI/s1600/20150313153510.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;press number 1 or enter number 1 in colom and OK to view [1] BD address !&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE26h_kCw3ctwiroV7ekv9prK-kKzkRpCum7az3zvZydhordtnyfLrGc0cL3lNLuFicGRFt5Ulm4FkglnJc4Y3bvpvpzHqx34asfZHwtk-sIP1RVxHI_6z8h35BMLxF_UhT1K3MxkJNGJM/s1600/20150313153212.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE26h_kCw3ctwiroV7ekv9prK-kKzkRpCum7az3zvZydhordtnyfLrGc0cL3lNLuFicGRFt5Ulm4FkglnJc4Y3bvpvpzHqx34asfZHwtk-sIP1RVxHI_6z8h35BMLxF_UhT1K3MxkJNGJM/s1600/20150313153212.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;press number 2 or enter number 2 in colom and OK to view [2] Write BD address !&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK9dxHhI0xcrmXREmdK96tFyLFZuZZd2Z9lWZcPEKBAgbTPsv4fTkSV81RIukTtkp5O5hElbGqSBTuDZ5ZN3Mk7EmhOSJAQp32vZe3ikDI2poP3iTS9DVkyMWHgKdyhMEpsXOyj1hmLRR1/s1600/20150313153555.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK9dxHhI0xcrmXREmdK96tFyLFZuZZd2Z9lWZcPEKBAgbTPsv4fTkSV81RIukTtkp5O5hElbGqSBTuDZ5ZN3Mk7EmhOSJAQp32vZe3ikDI2poP3iTS9DVkyMWHgKdyhMEpsXOyj1hmLRR1/s1600/20150313153555.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;and now is time to change new bluetooth MAC address. enter number between 1 until 16777214 in colom to change your new bluetooth MAC address 2 times with different or same number (up to you) !&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv9QxWKSFf5nsCijpEZzy65YEpZ3k-vqdfsTBROLE83bGdIAyT-DseZ_lTMVEv_7SahGTwpNh6BsbrZUhFYEiWFGAeq9Ka1ggF1gyZOVK34fr89PbxvBYrdq7SAgLQlBsgu1sA6HKlHC_W/s1600/20150313153222.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv9QxWKSFf5nsCijpEZzy65YEpZ3k-vqdfsTBROLE83bGdIAyT-DseZ_lTMVEv_7SahGTwpNh6BsbrZUhFYEiWFGAeq9Ka1ggF1gyZOVK34fr89PbxvBYrdq7SAgLQlBsgu1sA6HKlHC_W/s1600/20150313153222.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;exit to the home screen and turn on your bluetooth wait 3 second and turn of again !&lt;/li&gt;
&lt;li&gt;you can see the result in setting &amp;gt; about phone &amp;gt; system info.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWADzFlvD2CGduW2Of0mFt5Qp2mvVFS_NOrfT_ARy8XcwBuqv5arbFadcf8d5mq-rd-kDX8bBUh-vZwIFqP5pTqwPON_kY6SqqXA6FBI6TL9dCgJc19AK6T64ZWj-qCoIkEzw_HADnluct/s1600/20150313153718.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWADzFlvD2CGduW2Of0mFt5Qp2mvVFS_NOrfT_ARy8XcwBuqv5arbFadcf8d5mq-rd-kDX8bBUh-vZwIFqP5pTqwPON_kY6SqqXA6FBI6TL9dCgJc19AK6T64ZWj-qCoIkEzw_HADnluct/s1600/20150313153718.jpg&quot; /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
if this tips now work do again with different number to change bluetooth MAC address ! &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
all rig&lt;span style=&quot;color: #0000ee;&quot;&gt;&lt;u&gt;ht&lt;/u&gt;&lt;/span&gt; that is all about &lt;b&gt;how to change Bluetooth MAC adress in samsung corby 2 GT S3850&lt;/b&gt;. id you have any question about this tips or trick you can comment in this post or &lt;a href=&quot;http://malikmal98.blogspot.com/p/blog-page_19.html&quot;&gt;chat with me&lt;/a&gt;. &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
OK that&#39;s all thanks the last i say Good Luck !&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/4786575903179636620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/03/how-to-change-bluetooth-mac-adress-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4786575903179636620'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/4786575903179636620'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/03/how-to-change-bluetooth-mac-adress-in.html' title='how to change Bluetooth MAC address in samsung corby 2 GT S3850'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06106538735799077103</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB1Q3qLuEZk6oNDmcRM0uhJqIrwDGe_YIWGzaSFPCqINTkVKCkGH_71xDCuMOFwZ8UG9e9FHBs8sD95M98yY5_8-AXJLSAjmRIoZwDQDV4x8_diXsxPiYkvbBzp5tLXlQNi_MuYJVgKIms/s72-c/20150313153139.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3480530965459021795.post-1261837107994982857</id><published>2015-03-08T14:59:00.001+07:00</published><updated>2015-03-08T15:10:51.540+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="samsung corby 2"/><category scheme="http://www.blogger.com/atom/ns#" term="tips &amp; trik"/><title type='text'>3 ways to reset phone samsung corby 2 GT - S3850</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
well ladies and gentle man in here i would like to share for you all about &lt;b&gt;3&lt;/b&gt; &lt;b&gt;ways to reset phone samsung corby 2 GT - S3850&lt;/b&gt;. if you got problem with your corby 2, sure you&amp;nbsp; have question &lt;b&gt;how to reset samsung corby 2&lt;/b&gt; &lt;b&gt;?. &lt;/b&gt;and if you ask for any people usually got 2 ways to reset your corby 2. so.. i have 3 ways to reset phone samsung corby 2. you want to know ? see in below :&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRLsplQCNckFxf259_juVPqFuCRsW4l12yR4VSlZ2MsTYwkZ62v9gIpCO9pyHJAZ1GI5cfhfK-NjR7LjdsuqWuDA01LAGTEssytRWZSAbI1xtiy-HRob1MUs_fbQDYico2P1LdJ7R_4jJp/s1600/20150308145839.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRLsplQCNckFxf259_juVPqFuCRsW4l12yR4VSlZ2MsTYwkZ62v9gIpCO9pyHJAZ1GI5cfhfK-NjR7LjdsuqWuDA01LAGTEssytRWZSAbI1xtiy-HRob1MUs_fbQDYico2P1LdJ7R_4jJp/s1600/20150308145839.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;reset with code&lt;/b&gt; : this ways can reset your phone with normal condition. the mean your phone can open keypad. and you just write number first with * (star) and over # (fence). and wait the restart. alright this code for reset phone samsung corby 2 : *2767*3855# &lt;/li&gt;
&lt;li&gt;&lt;b&gt;reset with change CSC&lt;/b&gt; &lt;b&gt;pre configuration&lt;/b&gt; : well this is new way to reset samsung corby 2. i found it when i try many &lt;b&gt;secret codes for samsung corby 2&lt;/b&gt;. this way can reset your phone with normal condition too as first ways. this way just write number code to enter&amp;nbsp; &lt;b&gt;CSC pre configuration&lt;/b&gt;. and the code is *#272*clock#. clock is number of clock now or look at left of battery if the clock is 14:59 write *#272*1459#. and change other expect was changed. and&amp;nbsp; install. wand wait a minute for reset and reboot the phone.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;reset with flash&lt;/b&gt; : this is ways for reset phone samsung corby 2 if your phone can&#39;t use keypad number. or your phone have a &lt;b&gt;boot loop&lt;/b&gt;, the mean your phone when turn of the phone have &lt;b&gt;stopped at samsung logo&lt;/b&gt; or back again to boot and never open the home screen. and this way very long if i write in this post so i was write in post ago. and this way need a computer or laptop and cable data. you can see how to reset with flash in this link : &lt;a href=&quot;http://malikmal98.blogspot.com/2014/06/how-to-flash-samsung-corby-2-gt-s3850.html&quot;&gt;http://malikmal98.blogspot.com/2014/06/how-to-flash-samsung-corby-2-gt-s3850.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
ok that&#39;s all about&amp;nbsp; &lt;b&gt;3 ways to reset phone samsung corby 2 GT S3850&lt;/b&gt;.&lt;br /&gt;
thanks for visit this blog and GOOD LUCK !&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://malikmal98.blogspot.com/feeds/1261837107994982857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://malikmal98.blogspot.com/2015/03/3-ways-to-reset-phone-samsung-corby-2.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/1261837107994982857'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3480530965459021795/posts/default/1261837107994982857'/><link rel='alternate' type='text/html' href='https://malikmal98.blogspot.com/2015/03/3-ways-to-reset-phone-samsung-corby-2.html' title='3 ways to reset phone samsung corby 2 GT - S3850'/><author><name>Ikmalil Birri</name><uri>http://www.blogger.com/profile/00809121074236419552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRLsplQCNckFxf259_juVPqFuCRsW4l12yR4VSlZ2MsTYwkZ62v9gIpCO9pyHJAZ1GI5cfhfK-NjR7LjdsuqWuDA01LAGTEssytRWZSAbI1xtiy-HRob1MUs_fbQDYico2P1LdJ7R_4jJp/s72-c/20150308145839.jpg" height="72" width="72"/><thr:total>2</thr:total></entry></feed>