{"id":3146,"date":"2022-08-13T06:02:03","date_gmt":"2022-08-13T13:02:03","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3146"},"modified":"2022-08-13T06:02:03","modified_gmt":"2022-08-13T13:02:03","slug":"project-22-synthesizer-momentary-button-mk09","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3146","title":{"rendered":"Project #22: Synthesizer &#8211; Momentary Button &#8211; Mk09"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3146-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Arduino #AdafruitMETROM0Express #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02a.png\" alt=\"Momentary Button\" width=\"720\" height=\"461\" class=\"alignnone size-full wp-image-3148\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02a-300x192.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\/2022\/08\/DL2208Mk02b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02b.png\" alt=\"Momentary Button\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3149\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02b-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\/2022\/08\/DL2208Mk02c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02c.png\" alt=\"Momentary Button\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3150\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk02c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Momentary Button &#8211; Panel Mount<\/strong><\/p>\n<p>It&#8217;s your basic black or blue action button. This is a very useful, small, panel-mount momentary switch. It is a SPST N.O. with the threaded portion being 6.75 mm in diameter. This button is perfect for basic On\/Off functions. Overall length including leads and has small solder lugs for connection. These momentary buttons are rated up to 0.5A and 250VAC.<\/p>\n<p>Momentary button connect two points in a circuit when you press them. Turns on and off a light emitting LED. When the button is open there is no connection between the two legs of the button, so the pin is connected to ground, through the pull-down resistor, and we read a LOW. When the button is closed, it makes a connection between its two legs, connecting the pin to 5 volts, so that we read a HIGH.<\/p>\n<p>You can also wire this circuit the opposite way, with a pullup resistor keeping the input HIGH, and going LOW when the button is pressed. If so, the behavior of the sketch will be reversed, with the LED normally on and turning off when you press the button.<\/p>\n<p><strong>DL2208Mk02<\/strong><\/p>\n<p>1 x Adafruit METRO M0 Express<br \/>\n8 x Momentary Button &#8211; Panel Mount (Blue)<br \/>\n5 x Momentary Button &#8211; Panel Mount (Black)<br \/>\n13 x 10K Ohm Resistor<br \/>\n1 x LED Red 5mm<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Adafruit METRO M0 Express<\/strong><\/p>\n<p>KY0 &#8211; 0<br \/>\nKY1 &#8211; 1<br \/>\nKY2 &#8211; 2<br \/>\nKY3 &#8211; 3<br \/>\nKY4 &#8211; 4<br \/>\nKY5 &#8211; 5<br \/>\nKY6 &#8211; 6<br \/>\nKY7 &#8211; 7<br \/>\nKY8 &#8211; 8<br \/>\nLEDR &#8211; 9<br \/>\nKY10 &#8211; 10<br \/>\nKY11 &#8211; 11<br \/>\nKY12 &#8211; 12<br \/>\nKY13 &#8211; 13<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2208Mk02p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/* ***** Don Luc Electronics \u00a9 *****\r\nSoftware Version Information\r\nProject #22: Synthesizer - Momentary Button - Mk09\r\n22-09\r\nDL2208Mk02p.ino\r\n1 x Adafruit METRO M0 Express\r\n8 x Momentary Button - Panel Mount (Blue)\r\n5 x Momentary Button - Panel Mount (Black)\r\n13 x 1K Ohm Resistor\r\n1 x LED Red 5mm\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\r\n\r\n\/\/ Simple Keyboard\r\n\/\/ Minimum reading of the button that generates a note\r\n\/\/const int iKeyboard0 = 0;\r\nconst int iKeyboard1 = 1;\r\nconst int iKeyboard2 = 2;\r\nconst int iKeyboard3 = 3;\r\nconst int iKeyboard4 = 4;\r\nconst int iKeyboard5 = 5;\r\nconst int iKeyboard6 = 6;\r\nconst int iKeyboard7 = 7;\r\nconst int iKeyboard8 = 8;\r\nconst int iKeyboard10 = 10;\r\nconst int iKeyboard11 = 11;\r\nconst int iKeyboard12 = 12;\r\nconst int iKeyboard13 = 13;\r\n\/\/ Button is pressed\r\nint iB0 = 1;\r\nint iB1 = 1;\r\nint iB2 = 1;\r\nint iB3 = 1;\r\nint iB4 = 1;\r\nint iB5 = 1;\r\nint iB6 = 1;\r\nint iB7 = 1;\r\nint iB8 = 1;\r\nint iB10 = 1;\r\nint iB11 = 1;\r\nint iB12 = 1;\r\nint iB13 = 1;\r\n\r\n\/\/ The number of the LED Red pin 9\r\nconst int iLedR =  9;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;22-09&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ isKeyboard\r\n  isKeyboard();\r\n  \r\n}\r\n<\/pre>\n<p><strong>getKeyboard.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ getKeyboard\r\n\/\/ setupKeyboard\r\nvoid setupKeyboard() {\r\n\r\n  \/\/ Initialize the button pin as an input\r\n\/\/  pinMode(iKeyboard0, INPUT_PULLUP);\r\n  pinMode(iKeyboard1, INPUT_PULLUP);\r\n  pinMode(iKeyboard2, INPUT_PULLUP);\r\n  pinMode(iKeyboard3, INPUT_PULLUP);\r\n  pinMode(iKeyboard4, INPUT_PULLUP);\r\n  pinMode(iKeyboard5, INPUT_PULLUP);\r\n  pinMode(iKeyboard6, INPUT_PULLUP);\r\n  pinMode(iKeyboard7, INPUT_PULLUP);\r\n  pinMode(iKeyboard8, INPUT_PULLUP);\r\n  pinMode(iKeyboard10, INPUT_PULLUP);\r\n  pinMode(iKeyboard11, INPUT_PULLUP);\r\n  pinMode(iKeyboard12, INPUT_PULLUP);\r\n  pinMode(iKeyboard13, INPUT_PULLUP);\r\n \r\n}\r\n\/\/ isKeyboard\r\nvoid isKeyboard() {\r\n\r\n\/*\r\n  \/\/ Read the state of the button value 0\r\n  if ( digitalRead(iKeyboard0) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 0\r\n    iB0 = iB0 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB0 = iB0 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n*\/\r\n  \/\/ Read the state of the button value 1\r\n  if ( digitalRead(iKeyboard1) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 1\r\n    iB1 = iB1 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB1 = iB1 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 2\r\n  if ( digitalRead(iKeyboard2) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 2\r\n    iB2 = iB2 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB2 = iB2 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 3\r\n  if ( digitalRead(iKeyboard3) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 3\r\n    iB3 = iB3 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB3 = iB3 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 4\r\n  if ( digitalRead(iKeyboard4) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 4\r\n    iB4 = iB4 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB4 = iB4 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 5\r\n  if ( digitalRead(iKeyboard5) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 5\r\n    iB5 = iB5 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB5 = iB5 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 6\r\n  if ( digitalRead(iKeyboard6) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 6\r\n    iB6 = iB6 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB6 = iB6 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 7\r\n  if ( digitalRead(iKeyboard7) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 7\r\n    iB7 = iB7 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB7 = iB7 - 1;\/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 8\r\n  if ( digitalRead(iKeyboard8) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 8\r\n    iB8 = iB8 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB8 = iB8 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 10\r\n  if ( digitalRead(iKeyboard10) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 10\r\n    iB10 = iB10 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB10 = iB10 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 11\r\n  if ( digitalRead(iKeyboard11) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 11\r\n    iB11 = iB11 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB11 = iB11 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 12\r\n  if ( digitalRead(iKeyboard12) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 12\r\n    iB12 = iB12 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB12 = iB12 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 13\r\n  if ( digitalRead(iKeyboard13) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 13\r\n    iB13 = iB13 + 1;\r\n    \/\/ Turn LED Red on\r\n    digitalWrite(iLedR, HIGH );\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB13 = iB13 - 1;\r\n    \/\/ Turn LED Red off\r\n    digitalWrite(iLedR, LOW );\r\n    \r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ Setup Keyboard\r\n  setupKeyboard();\r\n\r\n  \/\/ Initialize the LED Red pin 9 as an output\r\n  pinMode(iLedR, OUTPUT);\r\n  \r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Technology Experience<\/strong><\/p>\n<ul>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Robotics<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<\/ul>\n<p><strong>Instructor and E-Mentor<\/strong><\/p>\n<ul>\n<li>IoT<\/li>\n<li>PIC Microcontrollers<\/li>\n<li>Arduino<\/li>\n<li>Raspberry Pi<\/li>\n<li>Espressif<\/li>\n<li>Robotics<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>J. Luc Paquin \u2013 Curriculum Vitae &#8211; 2022 English &#038; Espa\u00f1ol<\/strong><br \/>\nhttps:\/\/www.jlpconsultants.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.jlpconsultants.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Arduino #AdafruitMETROM0Express #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Momentary Button &#8211; Panel Mount It&#8217;s your basic black or blue action button. This is a very useful, small, panel-mount momentary switch. It is a SPST N.O. with the threaded portion being 6.75 mm in diameter. &#8230; <a title=\"Project #22: Synthesizer &#8211; Momentary Button &#8211; Mk09\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3146\" aria-label=\"Read more about Project #22: Synthesizer &#8211; Momentary Button &#8211; Mk09\">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":[205,47,50,49,38,59,5,58,10,43,51],"tags":[86,6,102,4,19,85,24,229,25,9,27,109,8,127,33,34],"class_list":["post-3146","post","type-post","status-publish","format-standard","hentry","category-synthesizer","category-adafruit","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-microcontrollers","category-arduino-programming","category-projects","category-sparkfun","category-synth","tag-adafruit","tag-arduino","tag-components","tag-consultant","tag-electronics","tag-fritzing","tag-microcontroller","tag-momentary-button","tag-musical-instruments-2","tag-programming","tag-projects-2","tag-sparkfun","tag-synth","tag-synthesizer","tag-technology","tag-video-blog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3146","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=3146"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3146\/revisions"}],"predecessor-version":[{"id":3151,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3146\/revisions\/3151"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}