{"id":27475,"date":"2022-12-24T23:04:29","date_gmt":"2022-12-24T23:04:29","guid":{"rendered":"https:\/\/www.pinballnews.com\/site\/?p=27475"},"modified":"2022-12-26T11:23:51","modified_gmt":"2022-12-26T11:23:51","slug":"pinball-add-on-controller-part-two","status":"publish","type":"post","link":"https:\/\/www.pinballnews.com\/site\/2022\/12\/24\/pinball-add-on-controller-part-two\/","title":{"rendered":"PINBALL ADD-ON CONTROLLER: PART TWO"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"614\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller-1024x614.jpg\" alt=\"Pinball News is all the news about pinball \u2013 you need to scope it out\" class=\"wp-image-27437\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller-1024x614.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller-300x180.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller-768x461.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller-1536x922.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller-850x510.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/001-pinball-add-on-controller.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Pinball News is all the news about pinball \u2013 you need to scope it out<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Purpose<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This article is the second part of a two part <a rel=\"noreferrer noopener\" href=\"https:\/\/www.pinballnews.com\/learn\/\" target=\"_blank\">Pinball News Learn How<\/a> set of articles. This second half concentrates on software, whereas the <a href=\"https:\/\/www.pinballnews.com\/site\/?p=27423\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/?p=27423\" target=\"_blank\" rel=\"noreferrer noopener\">first half<\/a> focused on hardware. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This set is a continuing update to a previous set (<a href=\"https:\/\/www.pinballnews.com\/site\/2017\/01\/11\/intro-to-arduino\/\" target=\"_blank\" rel=\"noreferrer noopener\">first<\/a> and <a href=\"https:\/\/www.pinballnews.com\/site\/2017\/01\/12\/pin-uino\/\" target=\"_blank\" rel=\"noreferrer noopener\">second<\/a>) of article halves. The subject of all four of these articles is the use of <a href=\"https:\/\/en.wikipedia.org\/wiki\/AVR_microcontrollers\" target=\"_blank\" rel=\"noreferrer noopener\">AVR RISC Microcontrollers<\/a> with pinball machines.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The purpose of this article pair is to provide general information and tips for creating your own AVR microcontroller based pinball add-ons, such as an interactive topper. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Though one specific pinball topper is covered in this half, it is only included for the purpose of bringing together software examples from this half and hardware examples from <a href=\"https:\/\/www.pinballnews.com\/site\/?p=27423\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/?p=27423\" target=\"_blank\" rel=\"noreferrer noopener\">the previous half<\/a>. Together, these two halves combine show one completed project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Introduction<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This second article deals with the use of Arduino software. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It starts with an explanation and a few simple Arduino sketches for <em>Digispark<\/em> clone boards. It them moves on to a more complicated programming example, requiring multiple inputs to control multiple outputs, and the use of a <em>Nano<\/em> clone board. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For information on running and using the Arduino IDE software to write and upload your sketches, see the <a href=\"https:\/\/www.pinballnews.com\/site\/2022\/10\/16\/new-ir-pinball-testers-part-two\/\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/2022\/10\/16\/new-ir-pinball-testers-part-two\/\" target=\"_blank\" rel=\"noreferrer noopener\">previous article about the Digispark-based IR testers<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As previously stated, the completed hardware and software project is shown in this half. Links for going further are also included towards the end of this article.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Information<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because the <em>Digispark <\/em>clone board is smaller and simpler than a <em>Nano <\/em>clone board, we will start by considering the <em>Digispark<\/em>. Its postage stamp size makes it ideal for easily hiding in a pinball topper or, when used for the addition of a custom playfield feature, finding space to mount it under the playfield. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Due to it being ATtiny85 microcontroller based, this board only has enough power and resources for a single lighting effect or single user-created feature. For larger, more complicated projects, a <em>Nano<\/em> clone board can be used instead. This board has greater storage for your sketch and can more easily use multiple inputs to control multiple outputs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This article will actually make two updates:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We will update from the use of a single microcontroller; by adding <strong>I<\/strong>nput\/<strong>O<\/strong>utput (<strong>I<\/strong>\/<strong>O<\/strong>) modules.<br><\/li>\n\n\n\n<li>We will also modernize from &#8216;dumb&#8217; discrete LEDs to &#8216;smart&#8217; LED modules called <em><a href=\"https:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide\/form-factors\" target=\"_blank\" rel=\"noreferrer noopener\">NeoPixels<\/a><\/em>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In a previous Pinball News article about updating the use of all discrete electronic components to an ATtiny85 microcontroller based board, we recommended to readers that they take the time to read and understand an associated <a href=\"http:\/\/digistump.com\/wiki\/digispark\/tutorials\/connecting\" target=\"_blank\" rel=\"noreferrer noopener\">user guide<\/a> for that board. The same holds true for this article. We recommend you take the time to read and understand the <em><a href=\"https:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide\" target=\"_blank\" rel=\"noreferrer noopener\">Adafruit NeoPixel \u00dcberguide<\/a><\/em>, by Phillip Burgess.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The two important take-aways from the <em>NeoPixel \u00dcberguide<\/em> are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>NeoPixels<\/em> require some RAM from the host microcontroller. This is a consideration for larger projects than in this article, in which case an <em>Arduino<\/em> or <em>Arduino<\/em> clone microcontroller board with greater RAM might need to be utilized.<br><\/li>\n\n\n\n<li>Each <em>NeoPixel<\/em> works on positive five volts (+5V) and draws as much as sixty milliamps (60mA) of direct current (dc). The use of more than a few <em>NeoPixels<\/em> can require more power than your board\u2019s built-in voltage regulator can provide.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Five things to remember while programming NeoPixels:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This type of LED has three dies: red, green &amp; blue<br><\/li>\n\n\n\n<li>The dies are used together in additive lighting to create millions of colors<br><\/li>\n\n\n\n<li>The die order many not be the same for all <em>NeoPixel<\/em> or <em>NeoPixel<\/em>-like LEDs and must be properly set-up for the additive lighting effect to work correctly<br><\/li>\n\n\n\n<li>Your sketch must include the <a href=\"https:\/\/github.com\/adafruit\/Adafruit_NeoPixel\">Adafruit_NeoPixel.h<\/a> <a href=\"https:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide\/arduino-library-use\">library<\/a>: <strong>#include &lt;Adafruit_NeoPixel.h&gt;<\/strong><br><\/li>\n\n\n\n<li><em>NeoPixels<\/em> are declared as an object. That object has three arguments: (LED_COUNT, LED_PIN, and NEO_Type)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Lastly, you should set the initial state of the <em>NeoPixels<\/em> at the beginning of your sketch. An example follows:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code><code>void setup() {<span style=\"background-color: initial; font-family: inherit; font-size: inherit; color: initial;\">   <\/span><\/code><code>strip.begin(); \/\/ Prepare the data pin for NeoPixel\n  strip.show(); \/\/ Initialize all pixels to 'off'\n}<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Digital Input to Control an Output<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will start with some building blocks. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first is one of the more easy and simple ways: one input, an <em>Arduino<\/em>-based microcontroller, a sketch and a single LED as the output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pictured juxtaposed below: the digital output of a passive infrared receiver (PIR) is used to supply a toggling signal to a <em>Digispark <\/em>microcontroller clone board, which in turn illuminates a single red LED on the high toggle.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/002-pinball-add-on-controller.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/002-pinball-add-on-controller-787x1024.jpg\" alt=\"A PIR sensor input, the Digispark clone, the LED output and a 5V battery pack\" class=\"wp-image-27438\" width=\"590\" height=\"768\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/002-pinball-add-on-controller-787x1024.jpg 787w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/002-pinball-add-on-controller-231x300.jpg 231w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/002-pinball-add-on-controller-768x999.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/002-pinball-add-on-controller-850x1106.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/002-pinball-add-on-controller.jpg 900w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><figcaption class=\"wp-element-caption\">A PIR sensor input, the <em>Digispark<\/em> clone, the LED output and a 5V battery pack<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">From looking at the associated sketch (HC-SR505PirRSensorTest.INO &#8211; shown below and <a rel=\"noreferrer noopener\" href=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/HC-SR505PirRSensorTest.INO.ino\" data-type=\"URL\" data-id=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/HC-SR505PirRSensorTest.INO.ino\" target=\"_blank\">downloadable here<\/a>), you may notice the <a href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/digital-io\/digitalread\/\" target=\"_blank\" rel=\"noreferrer noopener\">digital<\/a> HIGH and LOW states of the input module trigger a state change of the microcontroller <a href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/digital-io\/digitalwrite\/\" target=\"_blank\" rel=\"noreferrer noopener\">output<\/a>; from OFF to ON:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code><code>val = digitalRead (pirPin); \/\/ Read input value (active HIGH)<br>if (val == HIGH) \/\/ Check if input is HIGH<br>  digitalWrite(alarmLED, HIGH); \/\/ Turn LED ON<br>else {digitalWrite(alarmLED, LOW);} \/\/ Turn LED OFF<\/code><\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/003-pinball-add-on-controller.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/003-pinball-add-on-controller-755x1024.jpg\" alt=\"When motion is detected the input goes high and the Digispark sets the output high to light the LED\" class=\"wp-image-27439\" width=\"566\" height=\"768\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/003-pinball-add-on-controller-755x1024.jpg 755w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/003-pinball-add-on-controller-221x300.jpg 221w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/003-pinball-add-on-controller-768x1041.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/003-pinball-add-on-controller-850x1152.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/003-pinball-add-on-controller.jpg 900w\" sizes=\"auto, (max-width: 566px) 100vw, 566px\" \/><\/a><figcaption class=\"wp-element-caption\">When motion is detected the input goes high and the Digispark sets the output high to light the LED<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Look at the tiny red surface-mount LEDs on the <em>Digispark<\/em> clone board and the large output LED. In both pictures, notice the power indicator LED on the <em>Digispark<\/em> clone board remains constantly lit. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the first picture, notice how both the <em>Digispark<\/em> clone\u2019s on-board red LED and the red output LED are unlit. In the second picture, notice how both the on-board and output red LEDs are glowing. This was after the <a rel=\"noreferrer noopener\" href=\"https:\/\/learn.adafruit.com\/pir-passive-infrared-proximity-motion-sensor\" target=\"_blank\"><strong>PIR<\/strong><\/a> module was triggered. When the PIR module resets, the output LED turns off. This cycle continues as the PIR module gets re-triggered and resets itself.<br><br>The Arduino sketch for the example above follows. It is commented to list all of the connections and the operation of the sketch itself. You can also <a rel=\"noreferrer noopener\" href=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/HC-SR505PirRSensorTest.ino\" data-type=\"URL\" data-id=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/HC-SR505PirRSensorTest.ino\" target=\"_blank\">download it here<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code><code>\/\/ HC-SR505PirRSensorTest.ino\n\/* Pinball News\n&nbsp;* <a href=\"https:\/\/www.pinballnews.com\/site\/\">https:\/\/www.pinballnews.com\/site\/<\/a>\n&nbsp;* 09-OCT-22\\\\\n&nbsp;* This sketch is intended for public use.\n*\/\nint alarmLED = 1; \/\/ Output pin # for the LED\nint pirPin = 2; \/\/ Input pin # on Arduino from PIR sensor (active HIGH)\nint pirState = LOW; \/\/ Assuming no motion detected\nint val = 0; \/\/ Variable for reading pin status\nint flashCount = 3; \/\/ Variable for number of alarmLED flashes&nbsp;\nint flash = 33; \/\/ variable time for flashing the LED\nvoid setup() {\npinMode(alarmLED, OUTPUT); \/\/ declare LED as output\npinMode(pirPin, INPUT); \/\/ declare sensor as input\nfor (int k = 0; k &lt; (flashCount + flashCount); k++) { \/\/ Flash quick setup verification sequence\n&nbsp; if (k % 2 == 0) {\n&nbsp;&nbsp;&nbsp; digitalWrite(alarmLED, HIGH);\n&nbsp;&nbsp;&nbsp; }\n&nbsp; else {\n&nbsp;&nbsp;&nbsp; digitalWrite(alarmLED, LOW);\n&nbsp;&nbsp;&nbsp; }\n&nbsp; delay(flash);\n&nbsp; }\n}\nvoid loop() {\n&nbsp; val = digitalRead (pirPin); \/\/ Read input value (active HIGH)\n&nbsp;&nbsp;&nbsp; if (val == HIGH) \/\/ Check if input is HIGH\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(alarmLED, HIGH); \/\/ Turn LED ON&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp; else {digitalWrite(alarmLED, LOW);} \/\/ Turn LED OFF\n}<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Analog Input to Control an Output<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next we will move on to a slightly more complex building block.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pictured below: the analog output of a microphone module is used to send a varying signal to a <em>Nano<\/em> microcontroller clone board, which in turn provides varying input to a <em>NeoPixel<\/em> stick.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"719\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller-1024x719.jpg\" alt=\"A microphone module is the input, a NeoPixel stick is the output\" class=\"wp-image-27440\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller-1024x719.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller-300x211.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller-768x540.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller-1536x1079.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller-104x74.jpg 104w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller-850x597.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/004-pinball-add-on-controller.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">A microphone module is the input, a NeoPixel stick is the output<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">From looking at the associated sketch (NeoPixel-Color-Changing-VU-meter.ino &#8211; available to <a rel=\"noreferrer noopener\" href=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NeoPixel-Color-Changing-VU-meter.ino\" data-type=\"URL\" data-id=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NeoPixel-Color-Changing-VU-meter.ino\" target=\"_blank\">download here<\/a>), you may notice an analog value is: <a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/analog-io\/analogread\/\" target=\"_blank\">read<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/math\/map\/\" target=\"_blank\">mapped<\/a>, and <a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/analog-io\/analogwrite\/\" target=\"_blank\">written<\/a>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When changing, the assigned values of the written analog value are used to proved changes to the output device, a <em>NeoPixel<\/em> stick. By only slightly modifying this sketch, the Stick can easily be replaced by a <a href=\"https:\/\/learn.adafruit.com\/make-it-glow-your-first-neopixel-project\/choose-your-pixel-type\">different <\/a><em><a rel=\"noreferrer noopener\" href=\"https:\/\/learn.adafruit.com\/make-it-glow-your-first-neopixel-project\/choose-your-pixel-type\" target=\"_blank\">NeoPixel<\/a><\/em><a href=\"https:\/\/learn.adafruit.com\/make-it-glow-your-first-neopixel-project\/choose-your-pixel-type\"> type<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A microphone module is shown in the bottom left of the picture above. In this picture, notice the green barely-lit LED in top-left corner of the microphone module. The lighting of this LED signifies audible activity. This activity gets turned into a packet of digital information which is executed by the <em>NeoPixels<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Notice in the second picture, below, the green LED at top-left on the microphone module is extinguished; yet the <em>NeoPixel<\/em> strip on the right is holding its execution of color values. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller-1024x723.jpg\" alt=\"The upper green LED on the microphone module is off, signifying a lack of sound\" class=\"wp-image-27441\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller-1024x723.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller-300x212.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller-768x542.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller-1536x1085.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller-104x74.jpg 104w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller-850x600.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/005-pinball-add-on-controller.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The upper green LED on the microphone module is off, signifying a lack of sound<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The extinguishing of this single green LED signifies lack of audible activity, yet all of the <em>NeoPixels<\/em> remain lit. This situation is purposely chosen in the sketch for lighting homemade pinball machine add-ons and toppers.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls loop muted src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/025-pinball-add-on-controller.mov\" playsinline><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <em>Arduino <\/em>sketch for this second example shown above follows and can be <a href=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NeoPixel-Color-Changing-VU-meter.ino\" data-type=\"URL\" data-id=\"https:\/\/pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NeoPixel-Color-Changing-VU-meter.ino\" target=\"_blank\" rel=\"noreferrer noopener\">downloaded here<\/a>. It is commented to list all of the connections and the operation of the sketch itself.<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code>\/\/NeoPixel-Color-Changing-VU-meter.ino\n\/*\n * McSpaghetti\n * Aug 12, 2017\n * www.instagram.com\/mcspghetti\n * https:\/\/github.com\/EEPblog\/NeoPixel-Color-Changing-VU-meter\n*\/\n#include &lt;Adafruit_NeoPixel.h&gt;\n#ifdef __AVR__\n#include &lt;avr\/power.h&gt;\n#endif\n#define NUMPIXELS 8\nAdafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, 13, NEO_GRB + NEO_KHZ800);\nint val;\nint color = 0;\nbool change = 1;\nvoid setup() {\n  pixels.begin();\n  Serial.begin(115200);\n}\nvoid loop() {\n  int analog = analogRead(A0);  \/\/connect the Audio Source here, for best results use an OP amp front end.\n  int scale = 700;   \/\/this ultimately sets the sensitivity, basically the high point for the Vumeter\n  int threshold = 600; \/\/if the signal crosses this point, the VUmeter will change color\n  int hysterisis = 500; \/\/the hysterisis is necessary, since it determins the reset value before another color change   \n  val = map(analog, 0, scale, 1, NUMPIXELS); \/\/this scales the Audio source to the amount of pixels in our strip\n  \n  if ((analog &gt; threshold) &amp;&amp; (change == 1)) { \/\/this advances to the next color whenever it peaks over the threshold.\n    Color++;\n    if (color &gt; 4) {\n      color = 0;\n    }\n    change = 0;\n  }\n\n  if (analog &lt; hysterisis) {  \/\/this allows the change of the color for the next peak\n    change = 1;\n  }\n    \n  Serial.print(hysterisis); \/\/debugging stuff, best if used with Serial Plotter (CTRL + SHIFT + L)\n  Serial.print(\" ,\");       \/\/beware, that the serial stream runs at 115200 baud\n  Serial.print(threshold);\n  Serial.print(\" ,\");\n  Serial.print(scale);\n  Serial.print(\" ,\");\n  Serial.println(analog);\n\n  for (byte i = 0; i &lt; NUMPIXELS; i++) { \/\/this draws the palette for our strip depending on the color\nvariable\n    switch (color) {\n      case 4:\n        pixels.setPixelColor(i, map(i, 0, NUMPIXELS, 0, 255), map(i, 0, NUMPIXELS, 160, 0), 0);\n        break;\n      case 1:\n        pixels.setPixelColor(i, map(i, 0, NUMPIXELS, 0, 255), 0,  map(i, 0, NUMPIXELS, 255, 0));\n        break;\n      case 2:\n        pixels.setPixelColor(i, 0,  map(i, 0, NUMPIXELS, 0, 255), map(i, 0, NUMPIXELS, 255, 0));\n        break;\n      case 3:\n        pixels.setPixelColor(i, map(i, 0, NUMPIXELS, 0, 255), map(i, 0, NUMPIXELS, 255, 0), map(i,\n0, NUMPIXELS, 0, 255));\n        break;\n      case 0:\n        pixels.setPixelColor(i, map(i, 0, NUMPIXELS, 0, 255),  map(i, 0, NUMPIXELS, 0, 255),  map(i,\n0, NUMPIXELS, 255, 0));\n        break;\n    }\n  }\n  for (int i = NUMPIXELS; i &gt; val; i--) {  \/\/this then disables the pixels that don't need to be on\n    pixels.setPixelColor(i, 0, 0, 0);\n  }\n  pixels.show(); \/\/here we draw the result onto the actual LED strip\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Though much of what is covered in this article can be used to create your own pinball feature add-on or topper, the final project we will cover is a pinball topper project. That topper is a custom, &#8216;The Arkenstone&#8217; or &#8216;Heart of the Mountain&#8217;, from <em>The Hobbit<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-verse has-medium-font-size\" style=\"font-style:italic;font-weight:600\"><strong>\"It was a globe with a thousand facets; it shone like silver in the firelight, like water in the sun, like snow under the stars, like rain upon the Moon!\"<\/strong>\n\nTHORIN OAKENSHIELD, THE HOBBIT, CHAPTER XII: \"INSIDE INFORMATION\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This project is the goal of this set of articles, and uses something Pinball News has previously used as an input \u2013 a <a href=\"https:\/\/www.pinballnews.com\/site\/2017\/01\/12\/pin-uino\/\" target=\"_blank\" rel=\"noreferrer noopener\">LDR \/ 10Kohm<\/a> combination. This combination provides a trigger for either a <em>Digispark<\/em> or&nbsp;a <em>Nano<\/em> clone board, which in turn controls a random pattern going to <em>NeoPixels<\/em>, which finally light up the pinball topper.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By examining the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/structure\/sketch\/setup\/\" target=\"_blank\">set-up<\/a> portion of the associated sketch (NanoNeoPixeLDRSelfCal.ino which you can <a rel=\"noreferrer noopener\" href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NanoNeoPixeLDRSelfCal.ino\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NanoNeoPixeLDRSelfCal.ino\" target=\"_blank\">download here<\/a>), you can see that after the <a rel=\"noreferrer noopener\" href=\"https:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide\/arduino-library-use\" target=\"_blank\">states of the NeoPixels<\/a> are initially set, LRD\/resistor combination gets <a rel=\"noreferrer noopener\" href=\"https:\/\/assiss.github.io\/arduino-zhcn\/cn\/Tutorial\/Calibration.html\" target=\"_blank\">calibrated<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code>void setup() {\n  strip.begin(); \/\/ Initiate Neopixel library\n  strip.setBrightness(255); \/\/ Range = 000 through 255, 40 = Default, \n  strip.show(); \/\/ Initialize all pixels OFF\n  \n  while (millis() &lt; (calTime)){ \/\/ Calibrate during calTime \n    sensorValue = analogRead (LRDPin);\n    if (sensorValue &gt; sensorMax){ \/\/ Record sensorMax\n      sensorMax = sensorValue;\n    }\n    if (sensorValue &lt; sensorMin){ \/\/ Record sensorMin\n      sensorMin = sensorValue;\n    }    \n  }  \n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Because this initialization and calibration has been placed in the setup portion of the sketch, they run each time the microcontroller is powered up. It is this combination of events which makes the topper run automatically. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The mock-up pictured below shows the topper quickly flashing vibrantly when the game is turned on, and then automatically turning off the topper when the game goes dark. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"671\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller-1024x671.jpg\" alt=\"The Arkenstone topper\" class=\"wp-image-27442\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller-1024x671.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller-300x197.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller-768x503.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller-1536x1006.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller-850x557.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/006-pinball-add-on-controller.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The Arkenstone topper<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">If your add-on or topper does not act as expected, the first thing you can adjust in your sketch is the value of:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code>const int threshold = 53<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">See the sketch for notes on adjusting this starting value.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller-1024x538.jpg\" alt=\"Shown above are just three of the sparkling colors brightly glowing in 'the heart'\" class=\"wp-image-27443\" srcset=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller-1024x538.jpg 1024w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller-300x158.jpg 300w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller-768x404.jpg 768w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller-1536x807.jpg 1536w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller-850x447.jpg 850w, https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/007-pinball-add-on-controller.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Shown above are just three of the sparkling colors brightly glowing in &#8216;the heart&#8217;<\/figcaption><\/figure>\n<\/div>\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls loop muted src=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/023-pinball-add-on-controller.mov\" playsinline><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This last <em>Arduino <\/em>sketch, like the others, is commented to list all of the connections and describe the operation of the sketch itself.<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><code>\/* \n  NanoNeoPixeLDRSelfCal.INO\n  Todd Andersen\n  05-NOV-18\n  Updated for Pinball News\n  30-SEP-22\n*\/\n\n\/\/ Based on Random Flash Animation  \n\/\/   Random Flash Animation for Neopixel Ring Bangle Bracelet\n\/\/     by Dano Wall and Becky Stern for Adafruit Industries\n\/\/   In turn based on the Sparkle Skirt, minus the accelerometer\n\/\/     https:\/\/learn.adafruit.com\/neopixel-ring-bangle-bracelet\/code\n\n#include &lt;Adafruit_NeoPixel.h&gt;\n#define PIXELS 4 \/\/ Count of Neopixels on board \/ strip \/ ring\n#define PIN 1 \/\/ Arduino OUT pin for Din pin on Neopixels\n\nconst int LRDPin = A1; \/\/ Sensor pin = LRD, A1 for Digispark PB2 pin\nconst int threshold = 53; \/\/ Calibrated and mapped sensor trip point for LED display (10 to 100)\n                          \/\/ Smaller = More sensative, Larger = Less sensative\nconst int calTime = 3000; \/\/ Time allowed to calibrate trip point (2000 to 3000)\n\nint sensorValue = 0;  \/\/ Variable to store the value coming from the sensor\nint sensorMin = 1023;  \/\/ Variable to store sensor calibration mimimum\nint sensorMax= 0;  \/\/ Variable to store sensor calibration maximum\n\nint stepMin = 5; \/\/ Smaller = Fewer and Larger = Greater\nint stepsMax = 20; \/\/ Smaller = Fewer and Larger = Greater\nint steps = (random(stepMin, stepsMax)); \/\/ Set pseudorandom step fade in \/ out range\n\nint twinkMin = 5; \/\/ Smaller = Shorter and Larger = Longer\nint twinkMax = 20; \/\/ Smaller = Shorter and Larger = Longer\nint twinkle = (random(twinkMin, twinkMax)); \/\/ Set pseudorandom twinkle time\n\nint pixelMin = 1; \/\/ Smaller = Less and Larger = More\nint pixelMax = 4; \/\/ Smaller = Less and Larger = More\nint numPixels = (random(pixelMin, pixelMax)); \/\/ Set pseudorandom twinkling number of pixels\n\n\/\/ Parameter 1 = number of pixels (PIXELS)\n\/\/ Parameter 2 = pin number (PIN, most are valid)\n\/\/ Parameter 3 = pixel type flags, add together as needed:\n\/\/   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)\n\/\/   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)\n\/\/   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)\n\/\/   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w\/WS2812 LEDs)\n\nAdafruit_NeoPixel strip = Adafruit_NeoPixel(PIXELS, PIN, NEO_RGB);\n\n\/\/ Here is where you can put in your favorite colors that will appear!\n\/\/ just add new {nnn, nnn, nnn}, lines. They will be picked out randomly\n\/\/                          R   G   B       \/\/ Use NEO_RGB for NeoLEDs\nuint8_t myColors&#91;]&#91;3] = { {232, 100, 255},  \/\/ purple\n                          {230, 100, 020},  \/\/ yellow-red \n                          {255, 000, 000},  \/\/ red\n                          {255, 010, 100},  \/\/ off-red\n                          };\n                               \n\/\/ Don't edit the line below!\n#define FAVCOLORS sizeof (myColors) \/ 3\n\nvoid setup() {\n  strip.begin(); \/\/ Initiate Neopixel library\n  strip.setBrightness(255); \/\/ Range = 000 through 255, 40 = Default, \n  strip.show(); \/\/ Initialize all pixels OFF\n  \n  while (millis() &lt; (calTime)){ \/\/ Calibrate during calTime \n    sensorValue = analogRead (LRDPin);\n    if (sensorValue &gt; sensorMax){ \/\/ Record sensorMax\n      sensorMax = sensorValue;\n    }\n    if (sensorValue &lt; sensorMin){ \/\/ Record sensorMin\n      sensorMin = sensorValue;\n    }    \n  }  \n}\n\nvoid loop() {\n  sensorValue = analogRead (LRDPin); \/\/ Read LDR value\n  sensorValue = map (sensorValue, sensorMin, sensorMax, 10, 100); \/\/ Map calibrated sensorValue \n  sensorValue = constrain (sensorValue, 10, 100); \/\/ Constrain mapped sensorValue\n\n  if ((sensorValue) &gt; (threshold)){ \/\/ OFF if pinball machine OFF, GI lights = dark\n    return;\n  }\n               \nflashRandom:(twinkle, numPixels); \/\/ First number = 'Wait' delay, Smaller = Shorter twinkle\nflashRandom (twinkle, numPixels); \/\/ Second number = Number of neopixels to light at one time\nflashRandom (twinkle, numPixels);\n}\n\nvoid flashRandom(int wait, uint8_t howmany) {\n  for(uint16_t i=0; i&lt;howmany; i++) {    \n    \/\/ pick a random favorite color!\n    int c = random(FAVCOLORS);\n    int red = myColors&#91;c]&#91;0];\n    int green = myColors&#91;c]&#91;1];\n    int blue = myColors&#91;c]&#91;2]; \n \n    \/\/ get a random pixel from the list\n    int j = random(strip.numPixels());\n    \n    \/\/ now we will 'fade in' steps\n    for (int x=0; x &lt; steps; x++) {\n      int r = red * (x+1); r \/= steps;\n      int g = green * (x+1); g \/= steps;\n      int b = blue * (x+1); b \/= steps;\n        \n      strip.setPixelColor(j, strip.Color(r, g, b));\n      strip.show();\n      delay(wait);\n    }\n    \n    \/\/ &amp; 'fade out' steps\n    for (int x=5; x &gt;= 0; x--) {\n      int r = red * x; r \/= steps;\n      int g = green * x; g \/= steps;\n      int b = blue * x; b \/= steps;\n\n    \/\/ LEDs will be off when done (they are faded to 0)\n    strip.setPixelColor(j, strip.Color(r, g, b));\n    strip.show();\n    delay(wait);\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All of the sketches in this article are intended for public use, and any of them may be adjusted\/modified to fit the user\u2019s needs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To learn easy ways to marry Arduino <em>Digispark <\/em>and <em>Nano <\/em>clone boards to shields and modules, please see <a href=\"https:\/\/www.pinballnews.com\/site\/?p=27423\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/?p=27423\" target=\"_blank\" rel=\"noreferrer noopener\">the first article in this set<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Helpful Links for Going Further<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Controlling\/Using MOSFETs<br><a rel=\"noreferrer noopener\" href=\"https:\/\/create.arduino.cc\/projecthub\/search?q=mosfet\" target=\"_blank\">https:\/\/create.arduino.cc\/projecthub\/search?q=mosfet<\/a><br><\/li>\n\n\n\n<li>Controlling\/Using Motors<br><a rel=\"noreferrer noopener\" href=\"https:\/\/create.arduino.cc\/projecthub\/search?q=motor\" target=\"_blank\">https:\/\/create.arduino.cc\/projecthub\/search?q=motor<\/a><br><\/li>\n\n\n\n<li>Controlling\/Using NeoPixels<br><a rel=\"noreferrer noopener\" href=\"https:\/\/create.arduino.cc\/projecthub\/search?q=NeoPixel\" target=\"_blank\">https:\/\/create.arduino.cc\/projecthub\/search?q=NeoPixel<\/a><br><\/li>\n\n\n\n<li>Controlling\/Using Servos<br><a href=\"https:\/\/create.arduino.cc\/projecthub\/search?q=servo\">https:\/\/create.arduino.cc\/projecthub\/search?q=servo<\/a><br><\/li>\n\n\n\n<li><a href=\"\"><\/a>Controlling\/Using Relays<br><a href=\"https:\/\/create.arduino.cc\/projecthub\/search?q=relay\">https:\/\/create.arduino.cc\/projecthub\/search?q=relay<\/a><br><\/li>\n\n\n\n<li>Controlling\/Using Sound<br><a rel=\"noreferrer noopener\" href=\"https:\/\/create.arduino.cc\/projecthub\/projects\/tags\/sound\" target=\"_blank\">https:\/\/create.arduino.cc\/projecthub\/projects\/tags\/sound<\/a><br><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In addition, here are some extra sketches for the <em>Digispark<\/em> and <em>Nano<\/em> you may find useful in developing your own pinball add-ons.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NanoMusicReactRGB.ino\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/NanoMusicReactRGB.ino\" target=\"_blank\" rel=\"noreferrer noopener\">NanoMusicReactRGB.ino<br><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/LDRControlRandomFlashFadeNeopixel.ino\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/LDRControlRandomFlashFadeNeopixel.ino\" target=\"_blank\" rel=\"noreferrer noopener\">LDRControlRandomFlashFadeNeopixel.ino<br><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/TwinkleRockforLloyd.ino\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/TwinkleRockforLloyd.ino\" target=\"_blank\" rel=\"noreferrer noopener\">TwinkleRockforLloyd.ino<\/a><br><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/Digispark_LDR_Neopixel.ino\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/Digispark_LDR_Neopixel.ino\" target=\"_blank\" rel=\"noreferrer noopener\">Digispark_LDR_Neopixel.ino<\/a><br><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/DigisparkNeoPixelStarTwinkle.ino\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/DigisparkNeoPixelStarTwinkle.ino\" target=\"_blank\" rel=\"noreferrer noopener\">DigisparkNeoPixelStarTwinkle.ino<\/a><br><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/WhiteLEDsThrob.ino\" target=\"_blank\" rel=\"noreferrer noopener\">WhiteLEDsThrob.ino<\/a><br><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/DigiSparkNeoPixelRandomRGB.ino\" data-type=\"URL\" data-id=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/DigiSparkNeoPixelRandomRGB.ino\" target=\"_blank\" rel=\"noreferrer noopener\">DigiSparkNeoPixelRandomRGB.ino<\/a><br><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/DigiSparkNeoPixelCandle.ino\" target=\"_blank\" rel=\"noreferrer noopener\">DigiSparkNeoPixelCandle.ino<\/a><br><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/WS2812B_Blink_All_Colors.ino\" target=\"_blank\" rel=\"noreferrer noopener\">WS2812B_Blink_All_Colors.ino<\/a><br><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pinballnews.com\/site\/wp-content\/uploads\/learn\/pinball-add-on-controller\/DigiStumpNeoPixelCandle.ino\" target=\"_blank\" rel=\"noreferrer noopener\">DigiStumpNeoPixelCandle.ino<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This second article deals with the use of Arduino software. It starts with an explanation and a few simple Arduino sketches for Digispark clone boards. It them moves on to a more complicated programming example, requiring multiple inputs to control multiple outputs, and the use of a Nano clone board.<\/p>\n","protected":false},"author":2,"featured_media":27500,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[148,1940,1939,1937,1938,1941],"class_list":["post-27475","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","tag-arduino","tag-clone","tag-digispark","tag-microcontroller","tag-nano","tag-sketch"],"_links":{"self":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/27475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/comments?post=27475"}],"version-history":[{"count":10,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/27475\/revisions"}],"predecessor-version":[{"id":27522,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/posts\/27475\/revisions\/27522"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/media\/27500"}],"wp:attachment":[{"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/media?parent=27475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/categories?post=27475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pinballnews.com\/site\/wp-json\/wp\/v2\/tags?post=27475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}