{"id":216,"date":"2017-08-06T19:05:47","date_gmt":"2017-08-06T19:05:47","guid":{"rendered":"http:\/\/digm.drexel.edu\/uxid\/?p=216"},"modified":"2018-03-18T18:19:02","modified_gmt":"2018-03-18T18:19:02","slug":"what-does-the-fox-say-arduino-lcd-version","status":"publish","type":"post","link":"https:\/\/philsinatra.net\/branches\/uxid\/2017\/08\/06\/what-does-the-fox-say-arduino-lcd-version\/","title":{"rendered":"What Does The Fox Say? (Arduino LCD Version)"},"content":{"rendered":"<p>So this week after completing the <em>Arduino Starter Kit, Project 11: Crystal Ball<\/em> with my <a href=\"\u201chttp:\/\/digm.drexel.edu\/uxid\/2017\/08\/01\/arduino-week-04\/\u201c\">Interactive Digital Media class<\/a>, I was intrigued by the LCD screen and wondered how to create scrolling text. While the Liquid Crystal Library clearly documents the scrollDisplayLeft() function, this scrolls both lines simultaneously. So this got me thinking, can I make only one line scroll?<\/p>\n<p>After a lot of web searching in various Arduino forums and finding many people asking this question only to get \u2018this can\u2019t be done\u2019 as an answer I eventually stumbled upon <a href=\"\u201chttps:\/\/nishantarora.in\/tutorial-arduino-16x2-lcd-how-to-scroll-only-one-line-at-a-time-while-keeping-the-other-constant.naml\u201d\">this post<\/a> by Nishant Arora where he uses the subString() method to scroll a single line. Now I just needed content for the LCD display.<\/p>\n<p>I am not sure why, but the viral video <i>The Fox (What Does The Fox Say?)<\/i> by Ylvis kinda popped into my head so I looked up the lyrics and used them for my sketch.<\/p>\n<figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube\"><div class=\"wp-block-embed__wrapper\"><iframe  id=\"_ytid_12260\"  width=\"326\" height=\"183\"  data-origwidth=\"326\" data-origheight=\"183\" src=\"https:\/\/www.youtube.com\/embed\/jofNR_WkoCE?enablejsapi=1&autoplay=0&cc_load_policy=0&cc_lang_pref=&iv_load_policy=1&loop=0&modestbranding=0&rel=1&fs=1&playsinline=0&autohide=2&theme=dark&color=red&controls=1&\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure>\n<p>Now my idea is coming together. Loop back and forth between \u201cWhat does the fox say?\u201d and \u201cThe fox says (insert random response).\u201d A little tweaking of Nishant\u2019s code to flop the scrolling line to line two, update the switch function with my new fox sayings, and put the switch into its own function so that it could be reused easily.<\/p>\n<p>I also found that tinkercad.com now allows circuit design, so I started building my circuit there and writing my code in order to speed up the testing phase without needing to compile and upload every time to check to see if it works. Here is a <a href=\"https:\/\/www.tinkercad.com\/things\/3i2ALLzfEWc-the-fox-scrolling-lcd-text\" target=\"_blank\" rel=\"noopener\">public link<\/a>.<\/p>\n<p>Once I had the code working, I put it into the Arduino IDE and only had to play with the delay times to get the speed I wanted. Here is a video of the final<\/p>\n<figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube\"><div class=\"wp-block-embed__wrapper\"><iframe  id=\"_ytid_14464\"  width=\"326\" height=\"183\"  data-origwidth=\"326\" data-origheight=\"183\" src=\"https:\/\/www.youtube.com\/embed\/Qj2NsSkoikU?enablejsapi=1&autoplay=0&cc_load_policy=0&cc_lang_pref=&iv_load_policy=1&loop=0&modestbranding=0&rel=1&fs=1&playsinline=0&autohide=2&theme=dark&color=red&controls=1&\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure>\n<p><a href=\"http:\/\/tfinamore.com\/wp-content\/uploads\/2017\/08\/the-fox-arduino-schematic.png\"><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-125\" src=\"http:\/\/tfinamore.com\/wp-content\/uploads\/2017\/08\/the-fox-arduino-schematic-300x188.png\" alt=\"\" width=\"300\" height=\"188\" \/><\/a><\/p>\n<p>[codepen_embed height=&#8221;600&#8243; theme_id=&#8221;0&#8243; slug_hash=&#8221;rzjxBP&#8221; default_tab=&#8221;js&#8221; user=&#8221;findes&#8221;]See the Pen <a href=\"https:\/\/codepen.io\/findes\/pen\/rzjxBP\/\">Arduino &#8211; Scrolling LCD Text<\/a> by Troy Finamore (<a href=\"https:\/\/codepen.io\/findes\">@findes<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.[\/codepen_embed]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So this week after completing the Arduino Starter Kit, Project 11: Crystal Ball with my Interactive Digital Media class, I was intrigued by the LCD screen and wondered how to create scrolling text. While the Liquid Crystal Library clearly documents the scrollDisplayLeft() function, this scrolls both lines simultaneously. So this &hellip;<\/p>\n","protected":false},"author":2,"featured_media":217,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[21],"_links":{"self":[{"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/posts\/216"}],"collection":[{"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/comments?post=216"}],"version-history":[{"count":2,"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/posts\/216\/revisions"}],"predecessor-version":[{"id":3880,"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/posts\/216\/revisions\/3880"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/media\/217"}],"wp:attachment":[{"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/media?parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/categories?post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/philsinatra.net\/branches\/uxid\/wp-json\/wp\/v2\/tags?post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}