{"id":15496,"date":"2016-10-26T09:02:25","date_gmt":"2016-10-26T07:02:25","guid":{"rendered":"https:\/\/www.vcp.de\/pfadfinden\/?p=15496"},"modified":"2020-02-18T20:31:17","modified_gmt":"2020-02-18T19:31:17","slug":"raspberry-pi-adventskranz","status":"publish","type":"post","link":"https:\/\/vcp.de\/pfadfinden\/scoutlab\/raspberry-pi-adventskranz\/","title":{"rendered":"Raspberry Pi: Adventskranz"},"content":{"rendered":"<h2>Zielgruppe<\/h2>\n<p>Pfadfinderinnen- und Pfadfinderstufe<\/p>\n<h2>Zielsetzung<\/h2>\n<p>Aktuelles Datum bestimmen und die Adventsonntage f\u00fcr das aktuelle Jahr berechnen.<br \/>\nJeden Adventsonntag wird, bis Weihnachten, eine weitere LED zugeschaltet.<\/p>\n<h2>Dauer<\/h2>\n<p>ca. 40 Minuten<\/p>\n<h2>Material<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-15500 size-large\" src=\"https:\/\/www.vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz_Material-1024x274.png\" alt=\"\" width=\"800\" height=\"214\" srcset=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz_Material-1024x274.png 1024w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz_Material-300x80.png 300w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz_Material-768x205.png 768w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz_Material.png 1258w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Raspberry Pi<\/li>\n<li>Breadboard<\/li>\n<li>Jumper-Kabel<\/li>\n<li>Kabel<\/li>\n<li>4 gelbe LED<\/li>\n<li>4 Widerst\u00e4nde 220\u00a0\u03a9<\/li>\n<\/ul>\n<h2>Aufbau<\/h2>\n<p>Der Aufbau ist relativ einfach. LED\u2019s leuchten nur, wenn der Strom in die richtige Richtung flie\u00dft. Deswegen macht es Sinn, unterschiedliche Kabelfarben zu verwenden. Am besten Schwarz (- oder GND) f\u00fcr das k\u00fcrze Bein und Gr\u00fcn f\u00fcr das l\u00e4ngere Bein.<\/p>\n<p><a href=\"https:\/\/www.vcp.de\/pfadfinden\/wp-content\/uploads\/2016\/10\/LED-Aufbaue-leg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-15503\" src=\"https:\/\/www.vcp.de\/pfadfinden\/wp-content\/uploads\/2016\/10\/LED-Aufbaue-leg-80x300.png\" alt=\"\" width=\"80\" height=\"300\" srcset=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2016\/10\/LED-Aufbaue-leg-80x300.png 80w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2016\/10\/LED-Aufbaue-leg.png 145w\" sizes=\"auto, (max-width: 80px) 100vw, 80px\" \/><\/a><\/p>\n<p>Damit die LED nicht zu viel Strom bekommt und durchbrennt haben wir zwischen LED und Pin noch einen Widerstand geschaltet.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-15492 aligncenter\" src=\"https:\/\/www.vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz-kerzen_Steckplatine-300x289.png\" alt=\"\" width=\"300\" height=\"289\" srcset=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz-kerzen_Steckplatine-300x289.png 300w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz-kerzen_Steckplatine-1024x988.png 1024w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz-kerzen_Steckplatine-768x741.png 768w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz-kerzen_Steckplatine-1536x1482.png 1536w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/adventskranz-kerzen_Steckplatine-2048x1976.png 2048w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>[python]<br \/>\n#!\/usr\/bin\/env python<\/p>\n<p>import RPi.GPIO as GPIO<br \/>\nGPIO.setmode(GPIO.BCM)<br \/>\nGPIO.setwarnings(False)<br \/>\nimport datetime<\/p>\n<p>led_erster_advent = 6<br \/>\nled_zweiter_advent = 13<br \/>\nled_dritter_advent = 19<br \/>\nled_vierter_advent = 26<\/p>\n<p>GPIO.setup(led_erster_advent, GPIO.OUT)<br \/>\nGPIO.setup(led_zweiter_advent, GPIO.OUT)<br \/>\nGPIO.setup(led_dritter_advent, GPIO.OUT)<br \/>\nGPIO.setup(led_vierter_advent, GPIO.OUT)<\/p>\n<p>#aktuelle Zeit ermitteln<br \/>\nnow = datetime.datetime.now()<br \/>\n#Jahr aus der aktuellen Zeitangabe ermitteln<br \/>\njahr = now.year<\/p>\n<p>#Wochentag von Weihnachten ermitteln &amp;amp; Advent-Sonntage berechnen<br \/>\nweihnachten = datetime.datetime(jahr, 12, 25, 0, 0, 0)<br \/>\nwochentag = weihnachten.weekday()<br \/>\nvierter_advent = weihnachten &#8211; datetime.timedelta(wochentag + 1)<br \/>\ndritter_advent = weihnachten &#8211; datetime.timedelta(wochentag + 8)<br \/>\nzweiter_advent = weihnachten &#8211; datetime.timedelta(wochentag + 15)<br \/>\nerster_advent = weihnachten &#8211; datetime.timedelta(wochentag + 22)<\/p>\n<p>#LEDS aktivieren je nach Datum \/ Advent-Sonntag<br \/>\nif(now &amp;lt;= weihnachten):<br \/>\n    if(now &amp;gt;= erster_advent):<br \/>\n        GPIO.output(led_erster_advent, GPIO.HIGH)<br \/>\n    if(now &amp;gt;= zweiter_advent):<br \/>\n        GPIO.output(led_zweiter_advent, GPIO.HIGH)<br \/>\n    if(now &amp;gt;= dritter_advent):<br \/>\n        GPIO.output(led_dritter_advent, GPIO.HIGH)<br \/>\n    if(now &amp;gt;= vierter_advent):<br \/>\n        GPIO.output(led_vierter_advent, GPIO.HIGH)<\/p>\n<p>#Ausgabe der Uebersicht auf dem Bildschirm<br \/>\nprint now.strftime(&#8218;Die Advent-Sonntage im Jahr %Y&#8216;)<br \/>\nprint erster_advent.strftime(&#8218;1. Advent am %d.%m.%Y&#8216;)<br \/>\nprint zweiter_advent.strftime(&#8218;2. Advent am %d.%m.%Y&#8216;)<br \/>\nprint dritter_advent.strftime(&#8218;3. Advent am %d.%m.%Y&#8216;)<br \/>\nprint vierter_advent.strftime(&#8218;4. Advent am %d.%m.%Y&#8216;)<br \/>\n[\/python]<\/p>\n<p><a href=\"https:\/\/github.com\/pediehl\/raspberry-pi-adventskranz\/archive\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Arbeitsblatt &amp; Programmcode zum Download<\/strong><\/a><\/p>\n<h2>Wie starte ich das Python-Skript auf meinem Raspbery Pi?<\/h2>\n<ol>\n<li>\u00d6ffne\u00a0IDLE von der Hauptnavigation\u00a0(Menu&gt;Entwicklung&gt;Python 2\u00a0(IDLE).<\/li>\n<li>Erstelle\u00a0eine\u00a0neue Datei:\u00a0Klicke auf File &gt; New file.<\/li>\n<li>Speichere die\u00a0neue Datei: Klicke auf\u00a0File &gt; Save. Speichere die Datei als\u00a0adventskranz.py.<\/li>\n<li>Kopiere den Programmcode in die neue Datei. Speichere die \u00c4nderungen.<\/li>\n<li>Starte das Programm mit F5.<\/li>\n<\/ol>\n<div id='gallery-1' class='gallery galleryid-15496 gallery-columns-3 gallery-size-thumbnail'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_shell_starten.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_shell_starten-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_shell_starten-150x150.png 150w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_shell_starten-45x45.png 45w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/2016-10-26-130246_1280x1024_scrot.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/2016-10-26-130246_1280x1024_scrot-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/2016-10-26-130246_1280x1024_scrot-150x150.png 150w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/2016-10-26-130246_1280x1024_scrot-45x45.png 45w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_neues_programm.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_neues_programm-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_neues_programm-150x150.png 150w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/python_neues_programm-45x45.png 45w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div><\/figure>\n\t\t<\/div>\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-15487\" src=\"https:\/\/www.vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/IMG_20161025_215557-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/IMG_20161025_215557-300x225.jpg 300w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/IMG_20161025_215557-1024x768.jpg 1024w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/IMG_20161025_215557-768x576.jpg 768w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/IMG_20161025_215557-1536x1152.jpg 1536w, https:\/\/vcp.de\/pfadfinden\/wp-content\/uploads\/2020\/02\/IMG_20161025_215557.jpg 2000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Zielgruppe Pfadfinderinnen- und Pfadfinderstufe Zielsetzung Aktuelles Datum bestimmen und die Adventsonntage f\u00fcr das aktuelle Jahr berechnen. Jeden Adventsonntag wird, bis Weihnachten, eine weitere LED zugeschaltet. Dauer ca. 40 Minuten Material &nbsp; Raspberry Pi Breadboard Jumper-Kabel Kabel 4 gelbe LED 4 Widerst\u00e4nde 220\u00a0\u03a9 Aufbau Der Aufbau ist relativ einfach. LED\u2019s leuchten nur, wenn der Strom in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":15488,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[379],"tags":[],"class_list":["post-15496","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scoutlab"],"acf":[],"_links":{"self":[{"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/posts\/15496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/comments?post=15496"}],"version-history":[{"count":0,"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/posts\/15496\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/media\/15488"}],"wp:attachment":[{"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/media?parent=15496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/categories?post=15496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vcp.de\/pfadfinden\/wp-json\/wp\/v2\/tags?post=15496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}