{"id":829,"date":"2020-10-16T01:28:42","date_gmt":"2020-10-16T05:28:42","guid":{"rendered":"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/?p=829"},"modified":"2020-10-16T12:18:01","modified_gmt":"2020-10-16T16:18:01","slug":"the-skateboard-light-final-documentation","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/jrenglander\/the-skateboard-light-final-documentation\/","title":{"rendered":"The Skateboard Light \u2014 Final Documentation"},"content":{"rendered":"\n<p>When I began this course, I was juggling various ideas that all could have been very interesting. I decided to build the Skateboard Light because I like the idea of using a project for longer than its intended purpose, which in this case was this class. But the project did not come without challenge.&nbsp;<\/p>\n\n\n\n<p>This was the first project in which I used the laser cutter to make parts and while the machine would occasionally give me trouble, I was able to get all the parts. Also, wiring the 24 leds used in this project was not a fun task, to say the least. However, I am very happy with the result and plan to use this in the future.<\/p>\n\n\n\n<p>One note about the software, I utilized the arduino library ShiftOut for sending data to the shift registers controlling the leds. <\/p>\n\n\n\n<p>Below is a video of the Skateboard Light: (I figured out the exposure so it should look better than the video in my polish and present post)<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"jetpack-video-wrapper\"><iframe loading=\"lazy\" title=\"Project Update 5\" width=\"1000\" height=\"563\" src=\"https:\/\/www.youtube.com\/embed\/W6StEQwVkEk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p>The background music was taken from Andrew Luce&#8217;s remix of Day N&#8217; Nite by Kid Cudi. <\/p>\n\n\n\n<p>Also here are some photos of the Skateboard Light: <\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"485\" height=\"1024\" src=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-485x1024.jpg\" alt=\"\" data-id=\"833\" data-full-url=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-scaled.jpg\" data-link=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/?attachment_id=833\" class=\"wp-image-833\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-485x1024.jpg 485w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-379x800.jpg 379w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-768x1623.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-727x1536.jpg 727w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-969x2048.jpg 969w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-142x300.jpg 142w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005402-scaled.jpg 1211w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"485\" height=\"1024\" src=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-485x1024.jpg\" alt=\"\" data-id=\"834\" data-full-url=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-scaled.jpg\" data-link=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/?attachment_id=834\" class=\"wp-image-834\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-485x1024.jpg 485w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-379x800.jpg 379w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-768x1623.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-727x1536.jpg 727w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-969x2048.jpg 969w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-142x300.jpg 142w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005417-scaled.jpg 1211w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"485\" height=\"1024\" src=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-485x1024.jpg\" alt=\"\" data-id=\"842\" data-full-url=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-scaled.jpg\" data-link=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/?attachment_id=842\" class=\"wp-image-842\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-485x1024.jpg 485w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-379x800.jpg 379w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-768x1620.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-728x1536.jpg 728w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-971x2048.jpg 971w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-142x300.jpg 142w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_005700-1-scaled.jpg 1214w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"636\" height=\"1024\" src=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light-636x1024.jpg\" alt=\"\" data-id=\"841\" data-full-url=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light.jpg\" data-link=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/?attachment_id=841\" class=\"wp-image-841\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light-636x1024.jpg 636w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light-497x800.jpg 497w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light-768x1237.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light-954x1536.jpg 954w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light-1272x2048.jpg 1272w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light-186x300.jpg 186w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/Looking-up-at-skateboard-light.jpg 1497w\" sizes=\"auto, (max-width: 636px) 100vw, 636px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"485\" height=\"1024\" src=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-485x1024.jpg\" alt=\"\" data-id=\"843\" data-full-url=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-scaled.jpg\" data-link=\"http:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/?attachment_id=843\" class=\"wp-image-843\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-485x1024.jpg 485w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-379x800.jpg 379w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-768x1623.jpg 768w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-727x1536.jpg 727w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-969x2048.jpg 969w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-142x300.jpg 142w, https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/20201016_010743-1-scaled.jpg 1211w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>Also here is the main file for my code: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;debounce.h&gt;\r\n#include \"player.h\"\r\n\r\n\/\/ change flag\r\nbool needToUpdateLEDs = false;\r\n\r\nuint32_t firstNumberToShiftOut = 0;\r\nuint32_t secondNumberToShiftOut = 0;\r\n\r\n\/\/button pin constants\r\nconst int player1ButtonPin = 2;\r\nconst int player2ButtonPin = 3;\r\nconst int player3ButtonPin = 4;\r\nconst int player4ButtonPin = 5;\r\nconst int resetButtonPin = 6;\r\n\r\n\/\/Debounce timing \r\nconst unsigned long debounceDelay = 50;\/\/ time to wait after first button press in ms\nunsigned long lasDebounceTime = 0;\/\/ stores the last time the button bounced\r\n\r\n\/\/shift register pins\r\nconst int latchPin = 8; \/\/connect to pin 12 on shift register\r\nconst int clockPin = 12; \/\/connect to pin 11 on shift register \r\nconst int dataPin = 11; \/\/connect to serial in pin on shift register\r\n\r\n\/\/ button objects\r\ndebounce P1B(player1ButtonPin, debounceDelay);\r\ndebounce P2B(player2ButtonPin, debounceDelay);\r\ndebounce P3B(player3ButtonPin, debounceDelay);\r\ndebounce P4B(player4ButtonPin, debounceDelay);\r\ndebounce ResetButton(resetButtonPin, debounceDelay);\r\n\r\n\/\/ players\r\nplayer P1;\r\nplayer P2;\r\nplayer P3;\r\nplayer P4;\r\n\r\nvoid setup() {\r\n  pinMode(13, OUTPUT); \/\/ disable the built in led\r\n  digitalWrite(13, LOW);\r\n\r\n  \/\/initialize the buttons\r\n  P1B.Init();\r\n  P2B.Init();\r\n  P3B.Init();\r\n  P4B.Init();\r\n  ResetButton.Init();\r\n\r\n  \/\/initialize the players\r\n  P1.Init();\r\n  P2.Init();\r\n  P3.Init();\r\n  P4.Init();\r\n  \r\n\r\n  \/\/initialize the shift registers\r\n  pinMode(latchPin, OUTPUT);\r\n  pinMode(clockPin, OUTPUT);\r\n  pinMode(dataPin, OUTPUT);\r\n\r\n  \/\/turn off the leds when system is powered on\r\n  turnOffLED();\r\n\r\n}\r\n\r\nvoid loop() {\r\n  \/\/Check all the buttons\r\n  \r\n  \/\/ first button\r\n  if(P1B.CheckButtonPress()){\r\n    P1.addLetter();\r\n    needToUpdateLEDs = true;\r\n  }\r\n\r\n  \/\/ second button\r\n  if(P2B.CheckButtonPress()){\r\n    P2.addLetter();\r\n    needToUpdateLEDs = true;\r\n  }\r\n\r\n  \/\/ third button\r\n  if(P3B.CheckButtonPress()){\r\n    P3.addLetter();\r\n    needToUpdateLEDs = true;\r\n  }\r\n\r\n  \/\/ fourth button\r\n  if(P4B.CheckButtonPress()){\r\n    P4.addLetter();\r\n    needToUpdateLEDs = true;\r\n  }\r\n\r\n  if(ResetButton.CheckButtonPress()){\r\n    resetGame();\r\n  }\r\n\r\n  \/\/ Make updates if button was pressed\r\n  if(needToUpdateLEDs){\r\n    \/\/ Combine all player numbers   \r\n    turnOnLED(processPlayerLetters());\r\n    needToUpdateLEDs = false;\r\n  }\r\n}\r\n\r\nuint32_t processPlayerLetters(){\r\n      \/\/ combine p1 and p2 and p3 and p4 separately\r\n    firstNumberToShiftOut = (P2.getLetterCount() &lt;&lt; 5) | (P1.getLetterCount());\r\n    secondNumberToShiftOut = (P4.getLetterCount() &lt;&lt; 5) | (P3.getLetterCount());\r\n\r\n    \/\/ then combine the resulting numbers afterwards\r\n    uint32_t finalNumberToShiftOut = (secondNumberToShiftOut &lt;&lt; 10) | firstNumberToShiftOut;\r\n\r\n    return finalNumberToShiftOut;\r\n}\r\n\r\n\r\nvoid resetGame(){\r\n  \/\/Reset all the players\r\n  P1.Reset();\r\n  P2.Reset();\r\n  P3.Reset();\r\n  P4.Reset();\r\n\r\n  \/\/ raise the flag\r\n  needToUpdateLEDs = true;\r\n}\r\n\r\nvoid turnOnLED(uint32_t ledNum){\r\n  \/\/ split up ledNum\r\n  byte SR1 = ledNum; \/\/ SR1 gets the LS 8 bits\r\n  byte SR2 = ledNum &gt;&gt; 8; \/\/SR 2 gets the middle 8 bits\r\n  byte SR3 = ledNum &gt;&gt; 16; \/\/SR 3 gets MS 8 bits\r\n  \r\n  \/\/open the latch to allow data flow\r\n  digitalWrite(latchPin, LOW);\r\n\r\n  \/\/SR 3\r\n  shiftOut(dataPin, clockPin, MSBFIRST, SR3);\r\n  \r\n  \/\/SR 2\r\n  shiftOut(dataPin, clockPin, MSBFIRST, SR2);\r\n\r\n  \/\/SR 1\r\n  shiftOut(dataPin, clockPin, MSBFIRST, SR1);\r\n\r\n  \/\/close the latch to send data\r\n  digitalWrite(latchPin, HIGH);\r\n}\r\n\r\nvoid turnOffLED(){\r\n  digitalWrite(latchPin, LOW);\r\n  shiftOut(dataPin, clockPin, MSBFIRST, 0);\r\n  shiftOut(dataPin, clockPin, MSBFIRST, 0);\r\n  shiftOut(dataPin, clockPin, MSBFIRST, 0);\r\n  digitalWrite(latchPin, HIGH);\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When I began this course, I was juggling various ideas that all could have been very interesting. I decided to build the Skateboard Light because I like the idea of using a project for longer than its intended purpose, which in this case was this class. But the project did not come without challenge.&nbsp; This&#8230; <\/p>\n<div class=\"link-more\"><a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/jrenglander\/the-skateboard-light-final-documentation\/\">Read More<\/a><\/div>\n","protected":false},"author":169,"featured_media":727,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cybocfi_hide_featured_image":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-829","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"jetpack_featured_media_url":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-content\/uploads\/sites\/13\/2020\/10\/cropped-isometric-view.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/posts\/829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/users\/169"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/comments?post=829"}],"version-history":[{"count":7,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/posts\/829\/revisions"}],"predecessor-version":[{"id":859,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/posts\/829\/revisions\/859"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/media\/727"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/media?parent=829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/categories?post=829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/lightart-a20\/wp-json\/wp\/v2\/tags?post=829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}