{"id":2710,"date":"2025-11-28T13:04:10","date_gmt":"2025-11-28T12:04:10","guid":{"rendered":"https:\/\/faszination-spur1.de\/?p=2710"},"modified":"2025-11-28T19:33:58","modified_gmt":"2025-11-28T18:33:58","slug":"easy-introduction-to-arduino-co","status":"publish","type":"post","link":"https:\/\/faszination-spur1.de\/en\/aktuelles\/leichter-einstieg-in-arduino-co\/","title":{"rendered":"Easy introduction to Arduino &amp; Co"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Microcontroller for the model railway<\/h2>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;6a291057b18f6&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6a291057b18f6\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"525\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/faszination-spur1.de\/wp-content\/uploads\/2025\/11\/MK-5917_Neu_IMG_9922_20-1024x525.jpg\" alt=\"\" class=\"wp-image-2715\" srcset=\"https:\/\/faszination-spur1.de\/wp-content\/uploads\/2025\/11\/MK-5917_Neu_IMG_9922_20-1024x525.jpg 1024w, https:\/\/faszination-spur1.de\/wp-content\/uploads\/2025\/11\/MK-5917_Neu_IMG_9922_20-300x154.jpg 300w, https:\/\/faszination-spur1.de\/wp-content\/uploads\/2025\/11\/MK-5917_Neu_IMG_9922_20-768x394.jpg 768w, https:\/\/faszination-spur1.de\/wp-content\/uploads\/2025\/11\/MK-5917_Neu_IMG_9922_20-1536x788.jpg 1536w, https:\/\/faszination-spur1.de\/wp-content\/uploads\/2025\/11\/MK-5917_Neu_IMG_9922_20-2048x1051.jpg 2048w, https:\/\/faszination-spur1.de\/wp-content\/uploads\/2025\/11\/MK-5917_Neu_IMG_9922_20-1320x677.jpg 1320w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdata-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.thisImage.buttonRight\"\n\t\t\tdata-wp-style--top=\"state.thisImage.buttonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For our readers of Digitalmagazin 2026, we provide the programme codes for the article here. These can be copied and pasted directly into the Arduino IDE development environment and compiled from there. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the code for the first example from the article:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include \n#include \n#include \n\n#define SCREEN_WIDTH 128\n#define SCREEN_HEIGHT 64\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, -1);\n\nconst char* targets[] = {\n  \"Hersbruck r. d. Peg.\",\n  \"Wuerzburg\\above Neustadt a.d.Aisch\\and Kitzingen\",\n  \"Neumarkt Opf.\",\n  \"Bamberg Upper Fr.\"\n};\nconst int anzahlZiele = 4; \/\/ enter the number of entries in the \u201eziele\u201c array here\nint currentDestination = 0;\nunsigned long letzteUmschaltung = 0;\nconst unsigned long interval = 5000; \/\/ 5 seconds\n\nvoid setup() {\n  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {\n    for(;;); \/\/ Stop if display not found\n  }\n  display.clearDisplay();\n  display.setTextSize(1);\n  display.setTextColor(SSD1306_WHITE);\n}\n\nvoid loop() {\n  unsigned long now = millis();\n  if (now - lastSwitch &gt;= interval) {\n    lastToggle = now;\n    currentTarget = (currentTarget + 1) % numberTargets; \/\/ nextTarget\n    display.clearDisplay();\n    display.setCursor(0,0);\n    display.println(targets[currentTarget]);\n    display.display();\n  }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Below is the second code example, which is exchanged with the section starting with \u201evoid loop\u201c:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void loop() {\n  unsigned long now = millis();\n  if (now - lastSwitch &gt;= interval) {\n    lastToggle = now;\n    currentTarget = (currentTarget + 1) % numberTargets; \/\/ nextTarget\n    display.clearDisplay();\n    display.setCursor(0,20);\n    display.println(targets[currentTarget]);\n          \/\/ --- Additional text for target 1 ---\n    if (currentTarget == 0) {\n      display.setCursor(0,0);\n      display.println(\"5 min. later\");\n      }\n    else if (currentTarget == 3) {\n      display.setCursor(0,0);\n      display.println(\"Today track 3 \")\n<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>Microcontroller for the model railway<\/p>","protected":false},"author":2,"featured_media":2715,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,56],"tags":[],"class_list":["post-2710","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aktuelles","category-digitaltechnik"],"aioseo_notices":[],"publishpress_future_action":{"enabled":false,"date":"2026-06-17 09:20:55","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"category","extraData":[]},"publishpress_future_workflow_manual_trigger":{"enabledWorkflows":[]},"_links":{"self":[{"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/posts\/2710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/comments?post=2710"}],"version-history":[{"count":4,"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/posts\/2710\/revisions"}],"predecessor-version":[{"id":2728,"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/posts\/2710\/revisions\/2728"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/media\/2715"}],"wp:attachment":[{"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/media?parent=2710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/categories?post=2710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/faszination-spur1.de\/en\/wp-json\/wp\/v2\/tags?post=2710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}