{"id":218,"date":"2015-04-06T21:31:05","date_gmt":"2015-04-06T21:31:05","guid":{"rendered":"http:\/\/www.donluc.com\/?p=218"},"modified":"2015-04-06T21:31:05","modified_gmt":"2015-04-06T21:31:05","slug":"project-3-lcd-shield-mk3","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=218","title":{"rendered":"Project #3 &#8211; LCD Shield &#8211; Mk3"},"content":{"rendered":"<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.01.jpg\" alt=\"LCD Shield Mk3.01\" width=\"640\" height=\"480\" class=\"alignnone size-full wp-image-219\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.01.jpg 640w, https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.01-300x225.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.02.jpg\" alt=\"LCD Shield Mk3.02\" width=\"640\" height=\"480\" class=\"alignnone size-full wp-image-220\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.02.jpg 640w, https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.02-300x225.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.03.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.03.jpg\" alt=\"LCD Shield Mk3.03\" width=\"640\" height=\"480\" class=\"alignnone size-full wp-image-221\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.03.jpg 640w, https:\/\/www.donluc.com\/wp-content\/uploads\/2015\/04\/LCDShieldMk3.03-300x225.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>2 X Jumper Wires Premium 3&#8243; M\/M<\/p>\n<p>1 X Project #3 &#8211; LED Shield &#8211; Mk2<\/p>\n<p>LCDShieldMk3.0.ino<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">\r\n\/\/ ***** Don Luc *****\r\n\/\/ Software Version Information\r\n\/\/ 3.0\r\n\r\n\/\/ include the library code:\r\n#include &lt;Wire.h&gt;\r\n#include &lt;Adafruit_MCP23017.h&gt;\r\n#include &lt;Adafruit_RGBLCDShield.h&gt;\r\n#include &lt;SPI.h&gt;\r\n#include &lt;RTClib.h&gt;\r\n#include &lt;RTC_DS3231.h&gt;\r\n\r\nRTC_DS3231 RTC;\r\n\r\n#define SQW_FREQ DS3231_SQW_FREQ_1024     \/\/0b00001000   1024Hz\r\n\r\nAdafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();\r\n\r\n\/\/ These #defines make it easy to set the backlight color\r\n#define OFF 0x0\r\n#define RED 0x1\r\n#define YELLOW 0x3\r\n#define GREEN 0x2\r\n#define TEAL 0x6\r\n#define BLUE 0x4\r\n#define VIOLET 0x5\r\n#define WHITE 0x7\r\n\r\nboolean isChorno = false;\r\n\r\nchar datastr[100];\r\n\r\nvoid loop() {\r\n   \r\n  \/\/ timeChrono();\r\n  timeChrono();\r\n\r\n  uint8_t momentaryButton = RGBLCDShield.readButtons();\r\n\r\n  if ( momentaryButton ) {\r\n\r\n    RGBLCDShield.clear();\r\n  \r\n    RGBLCDShield.setCursor(0,0);\r\n    \r\n    if ( momentaryButton &amp; BUTTON_UP ) {\r\n      RGBLCDShield.print(&quot;GREEN - UP&quot;);\r\n      RGBLCDShield.setBacklight(GREEN);\r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_DOWN ) {\r\n      RGBLCDShield.print(&quot;RED - DOWN&quot;);\r\n      RGBLCDShield.setBacklight(RED);\r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_LEFT ) {\r\n      RGBLCDShield.print(&quot;BLUE - LEFT&quot;);\r\n      RGBLCDShield.setBacklight(BLUE);\r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_RIGHT ) {\r\n      RGBLCDShield.print(&quot;YELLOW - RIGHT&quot;);\r\n      RGBLCDShield.setBacklight(YELLOW);\r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_SELECT ) {\r\n      RGBLCDShield.print(&quot;OFF&quot;);\r\n      RGBLCDShield.setBacklight(OFF);\r\n    }\r\n        \r\n  }\r\n  \r\n  delay(3000);\r\n  \r\n}\r\n<\/pre>\n<p>setup.ino<\/p>\n<pre class=\"\">\r\nvoid setup() {\r\n\r\n  \/\/ set up the LCD's number of columns and rows: \r\n  RGBLCDShield.begin(16, 2);\r\n  RGBLCDShield.print(\"Don Luc!!!\");\r\n  RGBLCDShield.setBacklight(VIOLET);\r\n  \r\n  \/\/ ChronoDot\r\n  setupChrono();    \r\n  \r\n}\r\n<\/pre>\n<p>ChronoDot.ino<\/p>\n<pre class=\"\">\r\nvoid setupChrono() {\r\n\r\n  RTC.begin();\r\n  \r\n  DateTime now = RTC.now();\r\n  DateTime compiled = DateTime(__DATE__, __TIME__);\r\n  RTC.getControlRegisterData( datastr[0] );    \r\n\r\n}\r\n\r\nvoid timeChrono() {\r\n\r\n    DateTime now = RTC.now();\r\n    DateTime isNow (now.unixtime() + 5572 * 86400L + 26980);\r\n    \r\n    \/\/ set the cursor to column 0, line 1\r\n    RGBLCDShield.setCursor(0, 1);\r\n \r\n    if ( isChorno == false ) \r\n    {\r\n      isChorno = true;\r\n      RGBLCDShield.print(isNow.year(), DEC);\r\n      RGBLCDShield.print('\/');\r\n      RGBLCDShield.print(isNow.month(), DEC);\r\n      RGBLCDShield.print('\/');\r\n      RGBLCDShield.print(isNow.day(), DEC);\r\n      RGBLCDShield.print(' ');\r\n      RGBLCDShield.print(' ');\r\n    }\r\n    else if ( isChorno == true )\r\n    {\r\n      isChorno = false;\r\n      RGBLCDShield.print(isNow.hour(), DEC);\r\n      RGBLCDShield.print(':');\r\n      RGBLCDShield.print(isNow.minute(), DEC);\r\n      RGBLCDShield.print(':');\r\n      RGBLCDShield.print(isNow.second(), DEC);\r\n      RGBLCDShield.print(' ');\r\n      RGBLCDShield.print(' ');\r\n    }\r\n  \r\n}\r\n<\/pre>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2 X Jumper Wires Premium 3&#8243; M\/M 1 X Project #3 &#8211; LED Shield &#8211; Mk2 LCDShieldMk3.0.ino \/\/ ***** Don Luc ***** \/\/ Software Version Information \/\/ 3.0 \/\/ include the library code: #include &lt;Wire.h&gt; #include &lt;Adafruit_MCP23017.h&gt; #include &lt;Adafruit_RGBLCDShield.h&gt; #include &lt;SPI.h&gt; #include &lt;RTClib.h&gt; #include &lt;RTC_DS3231.h&gt; RTC_DS3231 RTC; #define SQW_FREQ DS3231_SQW_FREQ_1024 \/\/0b00001000 1024Hz Adafruit_RGBLCDShield RGBLCDShield = &#8230; <a title=\"Project #3 &#8211; LCD Shield &#8211; Mk3\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=218\" aria-label=\"Read more about Project #3 &#8211; LCD Shield &#8211; Mk3\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,50,5,10],"tags":[],"class_list":["post-218","post","type-post","status-publish","format-standard","hentry","category-lcdshield","category-arduino","category-microcontrollers","category-projects"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=218"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/218\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/218\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}