{"id":318,"date":"2020-01-06T12:40:06","date_gmt":"2020-01-06T12:40:06","guid":{"rendered":"https:\/\/starthardware.org\/en\/?p=318"},"modified":"2020-01-06T12:59:58","modified_gmt":"2020-01-06T12:59:58","slug":"open-fire-on-an-led-matrix-display","status":"publish","type":"post","link":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/","title":{"rendered":"Open fire on an LED matrix display"},"content":{"rendered":"\n<p>It is winter and the right time for warm thoughts. May this LED matrix open fire help.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/amzn.to\/35rFhuE\">Arduino compatible Ultimate Starter Set<\/a>* <\/li><li>or an <a href=\"https:\/\/amzn.to\/2Fnse2G\">Arduino<\/a>* (or <a href=\"https:\/\/amzn.to\/2Qse6vD\">compatible board<\/a>*), Cables and an <a href=\"https:\/\/amzn.to\/2QtARiP\">LED Matrix display with MAX7219<\/a>*<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Circuit<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"523\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/arduino-led-matrix-max7219-schaltplan-schaltung-circuit.jpg\" alt=\"Arduino LED Matrix display Max7219\" class=\"wp-image-319\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/arduino-led-matrix-max7219-schaltplan-schaltung-circuit.jpg 1200w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/arduino-led-matrix-max7219-schaltplan-schaltung-circuit-300x131.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/arduino-led-matrix-max7219-schaltplan-schaltung-circuit-1024x446.jpg 1024w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/arduino-led-matrix-max7219-schaltplan-schaltung-circuit-768x335.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>The LED matrix is connected directly to the Arduino. This requires three digital pins for SPI communication and two cables for the power supply (GND and 5V +).<\/p>\n\n\n\n<p>You can find more information on how the LED matrix works in the Tutorials section: <a href=\"https:\/\/starthardware.org\/en\/arduino-matrix-display-8-x-8-pixels-and-lots-of-fun\/\">Arduino Matrix Display 8 \u00d7 8 pixels and lots of fun<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Code<\/h2>\n\n\n\n<p>Here is the program code. The light height of the individual rows is determined.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (int(random(1)) == 0) {\n    for (int x = 0; x &lt; 8; x++) {\n      theHeightTarget[x] = int(random(5)) + 1;\n    }\n  }<\/code><\/pre>\n\n\n\n<p>Then the program tries to adjust the current light height.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/\/ update\n  for (int x = 0; x &lt; 8; x++) {\n    if (theHeightTarget[x] > theHeightCurrent[x])theHeightCurrent[x]++;\n    if (theHeightTarget[x] &lt; theHeightCurrent[x])theHeightCurrent[x]--;\n  }<\/code><\/pre>\n\n\n\n<p>This is then shown on the matrix.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/\/ show display \n  for (int x = 0; x &lt; 8; x++) {\n    for (int y = 0; y &lt; theHeightCurrent[x]; y++) {\n      lc.setLed(0, x, y, 1);\n    }\n    for (int y = theHeightCurrent[x]; y &lt; 8; y++) {\n      lc.setLed(0, x, y, 0);\n    }\n  }<\/code><\/pre>\n\n\n\n<p>Every now and then a spark is released and flies upwards.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ sparks\n  sparkX = int(random(8));\n  if (int(random(40)) == 0) {\n    for (int y = 4; y &lt; 8; y++) {\n      if (y == 4) {\n        lc.setLed(0, sparkX, y, 1);\n      } else {\n        lc.setLed(0, sparkX, y, 1);\n        lc.setLed(0, sparkX, y - 1, 0);\n      }\n      delay(25);\n    }\n  } else {\n    delay(100);\n  }<\/code><\/pre>\n\n\n\n<p>Find the complete code her:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include \"LedControl.h\"\nLedControl lc = LedControl(12, 11, 10, 1);\n\nint theHeightTarget[8];\nint theHeightCurrent[8];\n\nint fireHeight = 0;\nint sparkX = 0;\n\nvoid setup() {\n  lc.shutdown(0, false);\n  lc.setIntensity(0, 8);\n  lc.clearDisplay(0);\n  Serial.begin(115200);\n}\n\nvoid loop() {  \n  \/\/lc.clearDisplay(0);\n  \/\/ set Heights\n  if (int(random(1)) == 0) {\n    for (int x = 0; x &lt; 8; x++) {\n      theHeightTarget[x] = int(random(5)) + 1;\n    }\n  }\n\n  \/\/ update\n  for (int x = 0; x &lt; 8; x++) {\n    if (theHeightTarget[x] > theHeightCurrent[x])theHeightCurrent[x]++;\n    if (theHeightTarget[x] &lt; theHeightCurrent[x])theHeightCurrent[x]--;\n  }\n\n  \/\/ show display \n  for (int x = 0; x &lt; 8; x++) {\n    for (int y = 0; y &lt; theHeightCurrent[x]; y++) {\n      lc.setLed(0, x, y, 1);\n    }\n    for (int y = theHeightCurrent[x]; y &lt; 8; y++) {\n      lc.setLed(0, x, y, 0);\n    }\n  }\n\n  \/\/ spark \u2013 Funkenflug\n  sparkX = int(random(8));\n  if (int(random(40)) == 0) {\n    for (int y = 4; y &lt; 8; y++) {\n      if (y == 4) {\n        lc.setLed(0, sparkX, y, 1);\n      } else {\n        lc.setLed(0, sparkX, y, 1);\n        lc.setLed(0, sparkX, y - 1, 0);\n      }\n      delay(25);\n    }\n  } else {\n    delay(100);\n  }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It is winter and the right time for warm thoughts. May this LED matrix open fire help. Parts Arduino compatible Ultimate Starter Set* or an Arduino* (or compatible board*), Cables and an LED Matrix display with MAX7219* Circuit The LED matrix is connected directly to the Arduino. This requires three digital pins for SPI communication&hellip;&nbsp;<a href=\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Open fire on an LED matrix display<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":320,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[5],"tags":[],"class_list":["post-318","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino-projects"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Open fire on an LED matrix display - StartHardware - Tutorials for Arduino<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Open fire on an LED matrix display - StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"og:description\" content=\"It is winter and the right time for warm thoughts. May this LED matrix open fire help. Parts Arduino compatible Ultimate Starter Set* or an Arduino* (or compatible board*), Cables and an LED Matrix display with MAX7219* Circuit The LED matrix is connected directly to the Arduino. This requires three digital pins for SPI communication&hellip;&nbsp;Read More &raquo;Open fire on an LED matrix display\" \/>\n<meta property=\"og:url\" content=\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/\" \/>\n<meta property=\"og:site_name\" content=\"StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-06T12:40:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-01-06T12:59:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/openfire-1024x576.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"576\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Stefan Hermann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/starthardware.org\/en\/#website\",\"url\":\"https:\/\/starthardware.org\/en\/\",\"name\":\"StartHardware - Tutorials for Arduino\",\"description\":\"Arduino, Electronics, Fun\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/starthardware.org\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/openfire.gif\",\"contentUrl\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/openfire.gif\",\"width\":1200,\"height\":675,\"caption\":\"Arduino Open Fire on the LED Matrix\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#webpage\",\"url\":\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/\",\"name\":\"Open fire on an LED matrix display - StartHardware - Tutorials for Arduino\",\"isPartOf\":{\"@id\":\"https:\/\/starthardware.org\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#primaryimage\"},\"datePublished\":\"2020-01-06T12:40:06+00:00\",\"dateModified\":\"2020-01-06T12:59:58+00:00\",\"author\":{\"@id\":\"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59\"},\"breadcrumb\":{\"@id\":\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/starthardware.org\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Open fire on an LED matrix display\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59\",\"name\":\"Stefan Hermann\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/starthardware.org\/en\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g\",\"caption\":\"Stefan Hermann\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Open fire on an LED matrix display - StartHardware - Tutorials for Arduino","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/","og_locale":"en_US","og_type":"article","og_title":"Open fire on an LED matrix display - StartHardware - Tutorials for Arduino","og_description":"It is winter and the right time for warm thoughts. May this LED matrix open fire help. Parts Arduino compatible Ultimate Starter Set* or an Arduino* (or compatible board*), Cables and an LED Matrix display with MAX7219* Circuit The LED matrix is connected directly to the Arduino. This requires three digital pins for SPI communication&hellip;&nbsp;Read More &raquo;Open fire on an LED matrix display","og_url":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/","og_site_name":"StartHardware - Tutorials for Arduino","article_published_time":"2020-01-06T12:40:06+00:00","article_modified_time":"2020-01-06T12:59:58+00:00","og_image":[{"width":1024,"height":576,"url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/openfire-1024x576.gif","type":"image\/gif"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"Stefan Hermann","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/starthardware.org\/en\/#website","url":"https:\/\/starthardware.org\/en\/","name":"StartHardware - Tutorials for Arduino","description":"Arduino, Electronics, Fun","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/starthardware.org\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#primaryimage","inLanguage":"en-US","url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/openfire.gif","contentUrl":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2020\/01\/openfire.gif","width":1200,"height":675,"caption":"Arduino Open Fire on the LED Matrix"},{"@type":"WebPage","@id":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#webpage","url":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/","name":"Open fire on an LED matrix display - StartHardware - Tutorials for Arduino","isPartOf":{"@id":"https:\/\/starthardware.org\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#primaryimage"},"datePublished":"2020-01-06T12:40:06+00:00","dateModified":"2020-01-06T12:59:58+00:00","author":{"@id":"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59"},"breadcrumb":{"@id":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/starthardware.org\/en\/open-fire-on-an-led-matrix-display\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/starthardware.org\/en\/"},{"@type":"ListItem","position":2,"name":"Open fire on an LED matrix display"}]},{"@type":"Person","@id":"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59","name":"Stefan Hermann","image":{"@type":"ImageObject","@id":"https:\/\/starthardware.org\/en\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g","caption":"Stefan Hermann"}}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/comments?post=318"}],"version-history":[{"count":2,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/318\/revisions"}],"predecessor-version":[{"id":328,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/318\/revisions\/328"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media\/320"}],"wp:attachment":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media?parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/categories?post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/tags?post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}