{"id":81,"date":"2019-10-22T08:25:05","date_gmt":"2019-10-22T08:25:05","guid":{"rendered":"https:\/\/starthardware.org\/en\/?p=81"},"modified":"2019-10-22T08:25:06","modified_gmt":"2019-10-22T08:25:06","slug":"unit-11-arduino-and-the-button","status":"publish","type":"post","link":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/","title":{"rendered":"Unit 11 \u2013 Arduino and the Button"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>So, you come a long way! Was it fun? That is very important. Let\u2019s continue and I show you how to connect and program a button.<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">What is a button?<\/h4>\n\n\n\n<p>A button can close a circuit when it\u2019s pushed. If it is released the circuit is open again. One could say, it switches off by itself. Usually it is done by a build in spring.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright is-resized\"><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_1_1_breadboard_en.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_1_1_breadboard_en.png\" alt=\"\" class=\"wp-image-83\" width=\"180\" height=\"132\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_1_1_breadboard_en.png 718w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_1_1_breadboard_en-300x221.png 300w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>You already know the first part of the circuit. It is a LED with a resistor. But this time we will use the outer rows of the breadboard to provide the plus (5V) and minus (GND). That has many advantages since we often need to connect many parts to plus and minus.<\/p>\n\n\n\n<p>The image shows, how the holes on the edge of a breadboard are connected. This are rows. Let\u2019s use the blue one to connect the GND and the red one for 5V.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"447\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-parts-1024x447.png\" alt=\"\" class=\"wp-image-82\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-parts-1024x447.png 1024w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-parts-300x131.png 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-parts-768x335.png 768w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-parts.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Circuit Part 1<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1348\" height=\"1053\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement.jpg\" alt=\"Arduino Button if statement\" class=\"wp-image-84\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement.jpg 1348w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement-300x234.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement-768x600.jpg 768w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement-1024x800.jpg 1024w\" sizes=\"auto, (max-width: 1348px) 100vw, 1348px\" \/><\/figure>\n\n\n\n<p>The first part of the circuit is done, the second consists of a resistor and a button. If you use a button, you always need to use an additional resistor, too. It is called\u00a0<em>drop down resistor<\/em>\u00a0and helps Arduino to decide whether the button is pressed or not.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Circuit Part 2<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1346\" height=\"1052\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement2.jpg\" alt=\"Arduino Button if Statement Part 2\" class=\"wp-image-85\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement2.jpg 1346w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement2-300x234.jpg 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement2-768x600.jpg 768w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-if-statement2-1024x800.jpg 1024w\" sizes=\"auto, (max-width: 1346px) 100vw, 1346px\" \/><\/figure>\n\n\n\n<p>Let\u2019s check the circuit, again. We have a 100 kOhm (kilo ohm) resistor connected with the button. The connection between both is connected to a green cable which ends in the pin 11 of the Arduino. The other side of the resistor is connected to the GND (minus). It is the black cable. Through a red cable the other side of the button is connected to the plus (5V).<\/p>\n\n\n\n<p>If the button is not pressed, over the 100kOhm resistor the pin of the Arduino is just connected to the GND. If we push the button, it is also connected to the plus, but without a resistor placed in the line. Current is lazy and always looks for the easiest was. Since the button is pressed, there are two to choose. One with resistor to the GND and one without a resistor to 5V. How would you decide if you are between two bus stations? The one is hill up (with resistor), the other is hill down. Well, I would go for the hill down bus stop \ud83d\ude09<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_15_High-Low-en.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_15_High-Low-en-1024x640.png\" alt=\"Arduino Button function pull down resistor\" class=\"wp-image-86\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_15_High-Low-en-1024x640.png 1024w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_15_High-Low-en-300x188.png 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_15_High-Low-en-768x480.png 768w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/10_15_High-Low-en.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Check, whether your parts are connected correctly and now let\u2019s code!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, you come a long way! Was it fun? That is very important. Let\u2019s continue and I show you how to connect and program a button. What is a button? A button can close a circuit when it\u2019s pushed. If it is released the circuit is open again. One could say, it switches off by&hellip;&nbsp;<a href=\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Unit 11 \u2013 Arduino and the Button<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":87,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-81","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unit 11 \u2013 Arduino and the Button - StartHardware - Tutorials for Arduino<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unit 11 \u2013 Arduino and the Button - StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"og:description\" content=\"So, you come a long way! Was it fun? That is very important. Let\u2019s continue and I show you how to connect and program a button. What is a button? A button can close a circuit when it\u2019s pushed. If it is released the circuit is open again. One could say, it switches off by&hellip;&nbsp;Read More &raquo;Unit 11 \u2013 Arduino and the Button\" \/>\n<meta property=\"og:url\" content=\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/\" \/>\n<meta property=\"og:site_name\" content=\"StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-22T08:25:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-22T08:25:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-tutorial.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1446\" \/>\n\t<meta property=\"og:image:height\" content=\"813\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Stefan Hermann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/starthardware.org\/en\/#website\",\"url\":\"https:\/\/starthardware.org\/en\/\",\"name\":\"StartHardware - Tutorials for Arduino\",\"description\":\"Arduino, Electronics, Fun\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/starthardware.org\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-tutorial.jpg\",\"contentUrl\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-tutorial.jpg\",\"width\":1446,\"height\":813,\"caption\":\"Arduino Button Tutorial if Statement\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#webpage\",\"url\":\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/\",\"name\":\"Unit 11 \u2013 Arduino and the Button - StartHardware - Tutorials for Arduino\",\"isPartOf\":{\"@id\":\"https:\/\/starthardware.org\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#primaryimage\"},\"datePublished\":\"2019-10-22T08:25:05+00:00\",\"dateModified\":\"2019-10-22T08:25:06+00:00\",\"author\":{\"@id\":\"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59\"},\"breadcrumb\":{\"@id\":\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/starthardware.org\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unit 11 \u2013 Arduino and the Button\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59\",\"name\":\"Stefan Hermann\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/starthardware.org\/en\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g\",\"caption\":\"Stefan Hermann\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unit 11 \u2013 Arduino and the Button - StartHardware - Tutorials for Arduino","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/","og_locale":"en_US","og_type":"article","og_title":"Unit 11 \u2013 Arduino and the Button - StartHardware - Tutorials for Arduino","og_description":"So, you come a long way! Was it fun? That is very important. Let\u2019s continue and I show you how to connect and program a button. What is a button? A button can close a circuit when it\u2019s pushed. If it is released the circuit is open again. One could say, it switches off by&hellip;&nbsp;Read More &raquo;Unit 11 \u2013 Arduino and the Button","og_url":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/","og_site_name":"StartHardware - Tutorials for Arduino","article_published_time":"2019-10-22T08:25:05+00:00","article_modified_time":"2019-10-22T08:25:06+00:00","og_image":[{"width":1446,"height":813,"url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-tutorial.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"Stefan Hermann","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/starthardware.org\/en\/#website","url":"https:\/\/starthardware.org\/en\/","name":"StartHardware - Tutorials for Arduino","description":"Arduino, Electronics, Fun","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/starthardware.org\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#primaryimage","inLanguage":"en-US","url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-tutorial.jpg","contentUrl":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-button-tutorial.jpg","width":1446,"height":813,"caption":"Arduino Button Tutorial if Statement"},{"@type":"WebPage","@id":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#webpage","url":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/","name":"Unit 11 \u2013 Arduino and the Button - StartHardware - Tutorials for Arduino","isPartOf":{"@id":"https:\/\/starthardware.org\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#primaryimage"},"datePublished":"2019-10-22T08:25:05+00:00","dateModified":"2019-10-22T08:25:06+00:00","author":{"@id":"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59"},"breadcrumb":{"@id":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/starthardware.org\/en\/unit-11-arduino-and-the-button\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/starthardware.org\/en\/"},{"@type":"ListItem","position":2,"name":"Unit 11 \u2013 Arduino and the Button"}]},{"@type":"Person","@id":"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59","name":"Stefan Hermann","image":{"@type":"ImageObject","@id":"https:\/\/starthardware.org\/en\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5b5a74ee1d07024fd1eff9b1f7137108089169010a93afaee907b9325ee579a6?s=96&d=mm&r=g","caption":"Stefan Hermann"}}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":1,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":88,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/81\/revisions\/88"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media\/87"}],"wp:attachment":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}