{"id":69,"date":"2019-10-22T07:17:06","date_gmt":"2019-10-22T07:17:06","guid":{"rendered":"https:\/\/starthardware.org\/en\/?p=69"},"modified":"2019-10-22T07:17:08","modified_gmt":"2019-10-22T07:17:08","slug":"unit-8-its-alive","status":"publish","type":"post","link":"https:\/\/starthardware.org\/en\/unit-8-its-alive\/","title":{"rendered":"Unit 8 \u2013 It&#8217;s alive!"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Did your LED light up? Good work! Now let\u2019s make it blinking.<\/p><\/blockquote>\n\n\n\n<p>In order to make a LED blinking we need to switch it on and off. You already switched it <em>on<\/em> using the command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>digitalWrite(9, HIGH);<\/code><\/pre>\n\n\n\n<p>You can switch it off with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>digitalWrite(9, LOW);<\/code><\/pre>\n\n\n\n<p>So! HIGH means <em>on<\/em> and LOW means <em>off<\/em>? If you want to put it like that, yes. HIGH means that we switch 5 volts plus to the pin, LOW means that the GND (minus pole) is switched to the pin. Later, we will use it again, but now let\u2019s continue.<\/p>\n\n\n\n<p>We can simply use the circuit of\u00a0<a href=\"https:\/\/starthardware.org\/en\/2019\/10\/22\/unit-7-digital-out-your-first-program\/\">unit 7<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"800\" src=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-circuit-led-blink-1024x800.gif\" alt=\"Arduino Blink Circuit\" class=\"wp-image-60\" srcset=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-circuit-led-blink-1024x800.gif 1024w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-circuit-led-blink-300x235.gif 300w, https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-circuit-led-blink-768x600.gif 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Switching on and off should be repeated over and over again. That means, we have to put in the commands to the loop method. That looks like that:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void setup(){\n  pinMode(9,OUTPUT);\n}\n\nvoid loop(){\n  digitalWrite(9, HIGH);\n  digitalWrite(9, LOW);\n}<\/code><\/pre>\n\n\n\n<p>Upload it to your Arduino board and see what happens. (Klick in the menu on&nbsp;<em>File &gt; Upload<\/em>.<\/p>\n\n\n\n<p>Hm, the LED is still turned on even if the programming code looks correct. The Arduino repeats the switching on and off so fast, that we can\u2019t see the change. We need to break the program down somehow.<\/p>\n\n\n\n<p>To stop a program for a certain time we can use the command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>delay(1000);<\/code><\/pre>\n\n\n\n<p>It delays the program. The value in the brackets tells it, for how long in milliseconds. 1000 milliseconds are one second.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void setup(){\n  pinMode(9,OUTPUT);\n}\n\nvoid loop(){\n  digitalWrite(9, HIGH);\n  digitalWrite(9, LOW);\n  delay(1000);\n}<\/code><\/pre>\n\n\n\n<p>And now upload it to the Arduino.<\/p>\n\n\n\n<p>Tricky! Now, the LED stopped work completely. The LED is now switched on and almost immediately switched off. Afterwards we wait a second. Well, now it\u2019s obvious that we can\u2019t see something. Most of the time the LED is off and just for a fraction of time switched on. Let\u2019s try it that way:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void setup(){\n  pinMode(9,OUTPUT);\n}\n\nvoid loop(){\n  digitalWrite(9, HIGH);\n  delay(1000);\n  digitalWrite(9, LOW);\n  delay(1000);\n}<\/code><\/pre>\n\n\n\n<p>Hurray! Now it works. The LED is switched on (HIGH), lights up for one second and is switched off (LOW) for another second. That was fiddly, but now it is actually quite clear. The Arduino works so fast, that we sometimes need to use a little break.<\/p>\n\n\n\n<p>Now, it is your turn: Change the program in that way, that the LED blinks much faster. Here you can find the solution, but first try by your own:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void setup(){\n  pinMode(9,OUTPUT);\n}\n\nvoid loop(){\n  digitalWrite(9, HIGH);\n  delay(200);\n  digitalWrite(9, LOW);\n  delay(200);\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Did your LED light up? Good work! Now let\u2019s make it blinking. In order to make a LED blinking we need to switch it on and off. You already switched it on using the command: digitalWrite(9, HIGH); You can switch it off with: digitalWrite(9, LOW); So! HIGH means on and LOW means off? If you&hellip;&nbsp;<a href=\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Unit 8 \u2013 It&#8217;s alive!<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":70,"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-69","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 8 \u2013 It&#039;s alive! - 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-8-its-alive\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unit 8 \u2013 It&#039;s alive! - StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"og:description\" content=\"Did your LED light up? Good work! Now let\u2019s make it blinking. In order to make a LED blinking we need to switch it on and off. You already switched it on using the command: digitalWrite(9, HIGH); You can switch it off with: digitalWrite(9, LOW); So! HIGH means on and LOW means off? If you&hellip;&nbsp;Read More &raquo;Unit 8 \u2013 It&#8217;s alive!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/\" \/>\n<meta property=\"og:site_name\" content=\"StartHardware - Tutorials for Arduino\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-22T07:17:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-22T07:17:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-blink.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\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-8-its-alive\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-blink.jpg\",\"contentUrl\":\"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-blink.jpg\",\"width\":1200,\"height\":675,\"caption\":\"Arduino Blink\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#webpage\",\"url\":\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/\",\"name\":\"Unit 8 \u2013 It's alive! - StartHardware - Tutorials for Arduino\",\"isPartOf\":{\"@id\":\"https:\/\/starthardware.org\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#primaryimage\"},\"datePublished\":\"2019-10-22T07:17:06+00:00\",\"dateModified\":\"2019-10-22T07:17:08+00:00\",\"author\":{\"@id\":\"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59\"},\"breadcrumb\":{\"@id\":\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/starthardware.org\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unit 8 \u2013 It&#8217;s alive!\"}]},{\"@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 8 \u2013 It's alive! - 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-8-its-alive\/","og_locale":"en_US","og_type":"article","og_title":"Unit 8 \u2013 It's alive! - StartHardware - Tutorials for Arduino","og_description":"Did your LED light up? Good work! Now let\u2019s make it blinking. In order to make a LED blinking we need to switch it on and off. You already switched it on using the command: digitalWrite(9, HIGH); You can switch it off with: digitalWrite(9, LOW); So! HIGH means on and LOW means off? If you&hellip;&nbsp;Read More &raquo;Unit 8 \u2013 It&#8217;s alive!","og_url":"https:\/\/starthardware.org\/en\/unit-8-its-alive\/","og_site_name":"StartHardware - Tutorials for Arduino","article_published_time":"2019-10-22T07:17:06+00:00","article_modified_time":"2019-10-22T07:17:08+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-blink.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-8-its-alive\/#primaryimage","inLanguage":"en-US","url":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-blink.jpg","contentUrl":"https:\/\/starthardware.org\/en\/wp-content\/uploads\/2019\/10\/arduino-blink.jpg","width":1200,"height":675,"caption":"Arduino Blink"},{"@type":"WebPage","@id":"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#webpage","url":"https:\/\/starthardware.org\/en\/unit-8-its-alive\/","name":"Unit 8 \u2013 It's alive! - StartHardware - Tutorials for Arduino","isPartOf":{"@id":"https:\/\/starthardware.org\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#primaryimage"},"datePublished":"2019-10-22T07:17:06+00:00","dateModified":"2019-10-22T07:17:08+00:00","author":{"@id":"https:\/\/starthardware.org\/en\/#\/schema\/person\/811b16fabcbfeef4210ea79cf0990a59"},"breadcrumb":{"@id":"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/starthardware.org\/en\/unit-8-its-alive\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/starthardware.org\/en\/unit-8-its-alive\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/starthardware.org\/en\/"},{"@type":"ListItem","position":2,"name":"Unit 8 \u2013 It&#8217;s alive!"}]},{"@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\/69","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=69"}],"version-history":[{"count":1,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/posts\/69\/revisions\/71"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media\/70"}],"wp:attachment":[{"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/starthardware.org\/en\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}