{"id":1917,"date":"2019-08-28T07:11:33","date_gmt":"2019-08-28T14:11:33","guid":{"rendered":"http:\/\/www.donluc.com\/?p=1917"},"modified":"2019-08-28T07:11:33","modified_gmt":"2019-08-28T14:11:33","slug":"project-11-esp32-feather-push-button-mk02","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=1917","title":{"rendered":"Project #11: ESP32 Feather &#8211; Push Button &#8211; Mk02"},"content":{"rendered":"<p><strong>ESP32 Feather &#8211; Push Button &#8211; Mk02<\/strong><\/p>\n<p>&#8212;&#8212;<\/p>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1917-1\" width=\"720\" height=\"406\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/dl1908mk02.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/dl1908mk02.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/dl1908mk02.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02a.png\" alt=\"ESP32 Feather - Push Button - Mk02\" width=\"720\" height=\"615\" class=\"alignnone size-full wp-image-1919\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02a-300x256.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02b.png\" alt=\"ESP32 Feather - Push Button - Mk02\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-1920\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02c.png\" alt=\"ESP32 Feather - Push Button - Mk02\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-1921\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02d.png\" alt=\"ESP32 Feather - Push Button - Mk02\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-1922\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2019\/08\/DL1908Mk02d-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Momentary Pushbutton Switch<\/strong><\/p>\n<p>This is a standard 12mm square momentary button. What we really like is the large button head and good tactile feel (it &#8216;clicks&#8217; really well). This button is great for user input on a PCB or a good, big reset button on a breadboard. Breadboard friendly!<\/p>\n<p><strong>DonLuc1908Mk02<\/strong><\/p>\n<p>1 x Adafruit HUZZAH32 ESP32 Feather<br \/>\n1 x Adafruit SHARP Memory Display<br \/>\n1 x LED Green<br \/>\n1 x Push Button<br \/>\n1 x 100 Ohm<br \/>\n1 x 10K Ohm<br \/>\n12 x Jumper Wires 3&#8243; M\/M<br \/>\n1 x Full-Size Breadboard<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Adafruit HUZZAH32 ESP32 Feather<\/strong><\/p>\n<p>LG1 &#8211; Digital 21<br \/>\nPB1 &#8211; Digital 17<br \/>\nSCK &#8211; Digital 13<br \/>\nMOS &#8211; Digital 12<br \/>\nSSD &#8211; Digital 27<br \/>\nGND &#8211; GND<br \/>\nVIN &#8211; +3.3V<\/p>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Web:<\/strong> http:\/\/neosteamlabs.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> http:\/\/www.jlpconsultants.com\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Etsy:<\/strong> https:\/\/www.etsy.com\/shop\/NeoSteamLabs<\/p>\n<p><strong>DL1908Mk02p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DL1908Mk02p.ino\">\r\n\/\/ ***** Don Luc Electronics *****\r\n\/\/ Software Version Information\r\n\/\/ Project #11: HUZZAH32 ESP32 Feather - Push Button - Mk02\r\n\/\/ 08-02\r\n\/\/ DonLuc1908Mk02p.ino 08-02\r\n\/\/ Adafruit HUZZAH32 ESP32 Feather Board\r\n\/\/ SHARP Display\r\n\/\/ LED Green\r\n\/\/ Push Button\r\n\r\n\/\/ include Library Code\r\n#include &lt;Adafruit_SharpMem.h&gt;\r\n#include &lt;Adafruit_GFX.h&gt;\r\n\r\n\/\/ SHARP Memory Display\r\n\/\/ any pins can be used\r\n#define SHARP_SCK  13\r\n#define SHARP_MOSI 12\r\n#define SHARP_SS   27\r\n\/\/ Set the size of the display here, e.g. 144x168!\r\nAdafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);\r\n\/\/ The currently-available SHARP Memory Display (144x168 pixels)\r\n\/\/ requires &gt; 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno\r\n\/\/ or other &lt;4K &quot;classic&quot; devices!\r\n#define BLACK 0\r\n#define WHITE 1\r\nint minorHalfSize; \/\/ 1\/2 of lesser of display width or height\r\n\r\n\/\/ LED Green\r\nint iLEDGreen =  21;                 \/\/ LED Green\r\nint stateLEDGreen = LOW;             \/\/ stateLEDGreen \r\n\r\n\/\/ Button\r\nint iBut1 = 17;                      \/\/ Button 1\r\nint ButState1;                       \/\/ Variable for reading the button status\r\nint previous = LOW;                  \/\/ previous\r\nlong lTime = 0;                      \/\/ lTime\r\nlong debounce = 500;                 \/\/ debounce\r\n\r\nvoid loop() {\r\n  \r\n  \/\/ Read the state of the button value\r\n  ButState1 = digitalRead(iBut1);\r\n  \r\n  \/\/ Check if the button is pressed\r\n  if (ButState1 == HIGH &amp;&amp; previous == LOW &amp;&amp; millis() - lTime &gt; debounce) \r\n  {\r\n\r\n     if(stateLEDGreen == HIGH)\r\n     {\r\n      \r\n        \/\/ stateLEDGreen = LOW\r\n        stateLEDGreen = LOW;\r\n        \/\/ SHARP Memory Display Off\r\n        isDisplayOff();\r\n             \r\n     } else \r\n     {\r\n\r\n        \/\/ stateLEDGreen = HIGH\r\n        stateLEDGreen = HIGH; \r\n        \/\/ SHARP Memory Display On\r\n        isDisplayOn();\r\n            \r\n    }\r\n    lTime = millis();\r\n\r\n  } \r\n\r\n  \/\/ iLEDGreen\r\n  digitalWrite(iLEDGreen, stateLEDGreen);\r\n  previous == ButState1;  \r\n \r\n}\r\n<\/pre>\n<p><strong>getDisplay.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getDisplay.ino\">\r\n\/\/ SHARP Memory Display On\r\nvoid isDisplayOn() {\r\n\r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    \/\/ text display tests\r\n    display.setRotation(4);\r\n    \/\/display.clearDisplay();\r\n    display.setTextSize(5);\r\n    display.setTextColor(BLACK);\r\n    display.setCursor(10,25);\r\n    display.println(&quot;LED&quot;);\r\n    display.setCursor(10,75);\r\n    display.println(&quot;On&quot;);\r\n    display.refresh();\r\n\r\n}\r\n\/\/ SHARP Memory Display Off\r\nvoid isDisplayOff() {\r\n\r\n    \/\/ Clear Display\r\n    display.clearDisplay();\r\n    \/\/ text display tests\r\n    display.setRotation(4);\r\n    \/\/display.clearDisplay();\r\n    display.setTextSize(5);\r\n    display.setTextColor(BLACK);\r\n    display.setCursor(10,25);\r\n    display.println(&quot;LED&quot;);\r\n    display.setCursor(10,75);\r\n    display.println(&quot;Off&quot;);\r\n    display.refresh();\r\n\r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"setup.ino\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ SHARP Display start &amp; clear the display\r\n  display.begin();\r\n  display.clearDisplay();\r\n\r\n  \/\/ Button 1\r\n  \/\/ Initialize the button as an input\r\n  pinMode(iBut1, INPUT);\r\n  \r\n  \/\/ Initialize the LED Green\r\n  pinMode(iLEDGreen, OUTPUT);\r\n    \r\n}\r\n<\/pre>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ESP32 Feather &#8211; Push Button &#8211; Mk02 &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Momentary Pushbutton Switch This is a standard 12mm square momentary button. What we really like is the large button head and good tactile feel (it &#8216;clicks&#8217; really well). This button is great for user input on a PCB or a good, big &#8230; <a title=\"Project #11: ESP32 Feather &#8211; Push Button &#8211; Mk02\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=1917\" aria-label=\"Read more about Project #11: ESP32 Feather &#8211; Push Button &#8211; Mk02\">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":[81,47,80,59,5,82,10],"tags":[86,87,83,85,9,84],"class_list":["post-1917","post","type-post","status-publish","format-standard","hentry","category-esp32-project","category-adafruit","category-esp32","category-fritzing","category-microcontrollers","category-program-esp32","category-projects","tag-adafruit","tag-display","tag-esp32","tag-fritzing","tag-programming","tag-programming-esp32"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1917","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=1917"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1917\/revisions"}],"predecessor-version":[{"id":1924,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1917\/revisions\/1924"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}