{"id":7609,"date":"2015-06-18T09:15:45","date_gmt":"2015-06-18T16:15:45","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=7609"},"modified":"2021-06-16T16:18:35","modified_gmt":"2021-06-16T23:18:35","slug":"colorcolour-invaders","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/colorcolour-invaders\/","title":{"rendered":"Color\/Colour Invaders!"},"content":{"rendered":"<p>Welcome back to the Digilent Blog!<\/p>\n<p>&nbsp;<\/p>\n<p>This is a fun little project that I was recently inspired to try out by <a href=\"https:\/\/forum.digilent.com\/profile\/35-hamster\/\" target=\"_blank\" rel=\"noopener\">Hamster<\/a>&#8216;s own\u00a0<a href=\"http:\/\/hamsterworks.co.nz\/mediawiki\/index.php\/Colour_Invaders\" target=\"_blank\" rel=\"noopener\">\u200bColour Invaders project<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>As the name suggests, this project\u00a0is similar in design to the classic <a href=\"https:\/\/en.wikipedia.org\/wiki\/Space_Invaders\">Space Invaders<\/a> game or (more similarly) the\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=1YafgAcmov4\" target=\"_blank\" rel=\"noopener\">\u200bCasio&#8217;s Number Invaders<\/a>\u00a0on the calculator. The idea behind the game is that different colored &#8220;invaders&#8221; start marching down the LED strip and you have to fire missiles that match the color of the oncoming invader.\u00a0Naturally, as you successfully destroy more of the attackers, the faster they come towards your base. Luckily, we do get a nice bonus if we successfully destroy enough of them\u00a0in a row\u00a0\u2014 a super shot.<\/p>\n<p>&nbsp;<\/p>\n<p>My particular setup uses a set of 30 self-addressable\u00a0<a href=\"https:\/\/digilent.com\/blog\/Products\/Detail.cfm?NavPath=2,393,1315&amp;Prod=WS2812-WP\" target=\"_blank\" rel=\"noopener\">WS2812 LEDs<\/a>\u00a0whose weather-proof shielding is perfect for diffusing each of the LEDs. It also utilizes\u00a0a <a href=\"https:\/\/digilent.com\/blog\/Products\/Detail.cfm?NavPath=2,892,1035&amp;Prod=CHIPKIT-UC32\" target=\"_blank\" rel=\"noopener\">chipKIT uC32<\/a> microcontroller running <a href=\"http:\/\/www.instructables.com\/member\/mwingerson\/\" target=\"_blank\" rel=\"noopener\">Marshall<\/a>&#8216;s <a href=\"http:\/\/www.instructables.com\/id\/Addressable-LEDs-WS2812-on-chipKIT\/\" target=\"_blank\" rel=\"noopener\">PICxel library<\/a>,\u00a0allowing it to easily control all 30 LEDs (or <a href=\"https:\/\/digilent.com\/blog\/index.php\/the-led-grid-at-maker-faire-2015\/\" target=\"_blank\" rel=\"noopener\">900 of them<\/a>) with plenty of processing power to spare.<\/p>\n<figure id=\"attachment_7647\" aria-describedby=\"caption-attachment-7647\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/WS2812-strip-and-uC32.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-7647\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/WS2812-strip-and-uC32.jpg\" alt=\"WS2812 LED strip connected to a chipKIT uC32 micrcontroller\" width=\"600\" height=\"448\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/WS2812-strip-and-uC32.jpg 2592w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/WS2812-strip-and-uC32-600x448.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/WS2812-strip-and-uC32-1024x765.jpg 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/WS2812-strip-and-uC32-225x168.jpg 225w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/WS2812-strip-and-uC32-800x598.jpg 800w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-7647\" class=\"wp-caption-text\">WS2812 LED strip connected to a chipKIT uC32 micrcontroller.<\/figcaption><\/figure>\n<p>To cycle between each of the missile color options and fire the missile once it was ready, I used a <a href=\"https:\/\/digilent.com\/blog\/Products\/Detail.cfm?NavPath=2,401,479&amp;Prod=PMOD-ENC\" target=\"_blank\" rel=\"noopener\">PmodENC<\/a> and its associated library so that my code &#8220;catches&#8221; all of the rotations of the encoder shaft.<\/p>\n<figure id=\"attachment_7641\" aria-describedby=\"caption-attachment-7641\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/digilent.com\/blog\/Products\/Detail.cfm?NavPath=2,401,479&amp;Prod=PMOD-ENC\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7641 size-full\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/PmodENC.png\" alt=\"Digilent's PmodENC\" width=\"600\" height=\"394\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/PmodENC.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/PmodENC-225x148.png 225w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-7641\" class=\"wp-caption-text\">Digilent&#8217;s PmodENC.<\/figcaption><\/figure>\n<p>So, what do you think? Could you survive the onslaught against the color invaders?<\/p>\n<p>&nbsp;<\/p>\n<p>You can check out my YouTube video showing off some of this project in the video below:<\/p>\n<p><iframe loading=\"lazy\" width=\"735\" height=\"413\" src=\"https:\/\/www.youtube.com\/embed\/vrqmQA2MnSs?feature=oembed\" frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen><\/iframe><\/p>\n<p>What kind of game or fun uses for the WS2812 LEDs can you think of?<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-7609 jlk' data-task='like' data-post_id='7609' data-nonce='b777872406' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-7609 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-7609 jlk' data-task='unlike' data-post_id='7609' data-nonce='b777872406' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-7609 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-7609 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>I was recently inspired to try out by Hamster&#8217;s own \u200bColour Invaders project. As the name suggests, this project is similar in design to the classic Space Invaders game or (more similarly) the \u200bCasio&#8217;s Number Invaders on the calculator. The idea behind the game is that different colored &#8220;invaders&#8221; start marching down the LED strip and you have to fire missiles that match the color of the oncoming invader. Naturally, as you successfully destroy more of the attackers, the faster they come towards your base. Here is what you need to get started.<\/p>\n","protected":false},"author":17,"featured_media":7622,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[38],"tags":[104],"ppma_author":[4469],"class_list":["post-7609","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-expansion-modules","tag-project-2"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/06\/the-invaders.jpg","authors":[{"term_id":4469,"user_id":17,"is_guest":0,"slug":"jamescolvin","display_name":"James Colvin","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/8aa85f7d11711acc7e571e1ed26c901b614a7064a2e15e522f54d9f26792ea9e?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/7609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=7609"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/7609\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/7622"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=7609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=7609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=7609"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=7609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}