{"id":1769,"date":"2024-09-10T08:00:00","date_gmt":"2024-09-10T06:00:00","guid":{"rendered":"https:\/\/www.fuhselab.de\/?p=1769"},"modified":"2025-05-28T07:10:53","modified_gmt":"2025-05-28T05:10:53","slug":"arduino-led-interface-2","status":"publish","type":"post","link":"https:\/\/www.fuhselab.de\/index.php\/2024\/09\/10\/arduino-led-interface-2\/","title":{"rendered":"Arduino LED Interface 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><br>Der Crossover von Webdesign Gruppe und Arduino Gruppe geht in die zweite Runde und das Interface bekommt nun seinen PHP Code&#8230;<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\"><br><strong>Der PHP Code f\u00fcr das LED Interface:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n$port = fopen(\"\/dev\/ttyUSB0\",\"w\");\nsleep(2);\n?&gt;\n\n&lt;br \/&gt;&lt;br \/&gt;\n\n&lt;form action=\"index.php\" method=\"POST\"&gt;\n&lt;input type=\"hidden\" name=\"turn\" value=\"on\" \/&gt;\n&lt;input type=\"submit\" value=\"LED einschalten\" \/&gt;\n&lt;input type=\"reset\" value=\"Reset\" \/&gt;\n&lt;\/form&gt;\n\n&lt;br \/&gt;&lt;br \/&gt;\n\n&lt;form action=\"index.php\" method=\"POST\"&gt;\n&lt;input type=\"hidden\" name=\"turn\" value=\"off\" \/&gt;\n&lt;input type=\"submit\" value=\"LED ausschalten\" \/&gt;\n&lt;input type=\"reset\" value=\"Reset\" \/&gt;\n&lt;\/form&gt;\n\n&lt;br \/&gt;&lt;br \/&gt;\n\n&lt;?php\nif($_POST&#91;\"turn\"]==\"on\")\n{\necho \"Die LED ist eingeschaltet.\";\nfwrite($port, \"n\");\n}\nif($_POST&#91;\"turn\"]==\"off\")\n{\necho \"Die LED ist ausgeschaltet.\";\nfwrite($port, \"f\");\n}\nfclose($port);\n?&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Anpassungen der index-Datei:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Der PHP Code kann einfach in den ersten Artikel der index-Datei eingef\u00fcgt werden.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;article&gt;\n&lt;h1&gt;Arduino LED Interface:&lt;\/h1&gt;\n&lt;p&gt;\nPHP Code hier einf\u00fcgen...\n&lt;\/p&gt;\n&lt;\/article&gt;\n&lt;br \/&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Die index-Datei wird nun von index.html in index.php umbenannt. Entsprechend sollten dann nat\u00fcrlich auch die Hyperlinks im Navigationsbereich angepasst werden.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt; \n&lt;html lang=\"de\"&gt;\n\n&lt;head&gt; \n   &lt;title&gt;Arduino LED Interface&lt;\/title&gt;\n   &lt;link rel=\"stylesheet\" href=\"01_CSS\/01_zentrale.css\" type=\"text\/css\" \/&gt;\n   &lt;meta charset=\"UTF-8\"&gt;\n&lt;\/head&gt; \n\n&lt;body&gt;\n\n&lt;div id=\"wrapper\"&gt;\n\n&lt;header&gt;\n&lt;\/header&gt;\n&lt;nav&gt;\n&lt;ul&gt;\n   &lt;li&gt;&lt;a href=\"index.php\"&gt;Gesamt\u00fcbersicht&lt;\/a&gt;&lt;\/li&gt;\n   &lt;li&gt;&lt;a href=\"index.php\"&gt;Startseite&lt;\/a&gt;&lt;\/li&gt;\n&lt;\/ul&gt;\n&lt;\/nav&gt; \n\n&lt;main&gt;\n\n&lt;article&gt;\n&lt;h1&gt;Arduino LED Interface:&lt;\/h1&gt;\n&lt;p&gt;\n\n&lt;?php\n$port = fopen(\"\/dev\/ttyUSB0\",\"w\");\nsleep(2);\n?&gt;\n\n&lt;br \/&gt;&lt;br \/&gt;\n\n&lt;form action=\"index.php\" method=\"POST\"&gt;\n&lt;input type=\"hidden\" name=\"turn\" value=\"on\" \/&gt;\n&lt;input type=\"submit\" value=\"LED einschalten\" \/&gt;\n&lt;input type=\"reset\" value=\"Reset\" \/&gt;\n&lt;\/form&gt;\n\n&lt;br \/&gt;&lt;br \/&gt;\n\n&lt;form action=\"index.php\" method=\"POST\"&gt;\n&lt;input type=\"hidden\" name=\"turn\" value=\"off\" \/&gt;\n&lt;input type=\"submit\" value=\"LED ausschalten\" \/&gt;\n&lt;input type=\"reset\" value=\"Reset\" \/&gt;\n&lt;\/form&gt;\n\n&lt;br \/&gt;&lt;br \/&gt;\n\n&lt;?php\nif($_POST&#91;\"turn\"]==\"on\")\n{\necho \"Die LED ist eingeschaltet.\";\nfwrite($port, \"n\");\n}\nif($_POST&#91;\"turn\"]==\"off\")\n{\necho \"Die LED ist ausgeschaltet.\";\nfwrite($port, \"f\");\n}\nfclose($port);\n?&gt;\n\n&lt;\/p&gt;\n&lt;\/article&gt;\n&lt;br \/&gt;\n\n&lt;\/main&gt; \n\n&lt;footer&gt; \n&lt;\/footer&gt;\n\n&lt;\/div&gt; \n\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Das LED Interface und die Webserverumgebung:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Innerhalb der lokalen Webserverumgebung (hier: localhost\/01_Interface\/index.php) sollte das LED Interface nun erreichbar sein.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Im n\u00e4chsten Schritt geht es nun an den Arduino und den Arduino Code und diesen n\u00e4chsten Schritt machen wir im n\u00e4chsten Artikel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Der Crossover von Webdesign Gruppe und Arduino Gruppe geht in die zweite Runde und das Interface bekommt nun seinen PHP Code&#8230;<\/p>\n","protected":false},"author":1,"featured_media":48,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[22],"class_list":["post-1769","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","tag-arduino-gruppe-peine"],"_links":{"self":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/1769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/comments?post=1769"}],"version-history":[{"count":2,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/1769\/revisions"}],"predecessor-version":[{"id":2840,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/1769\/revisions\/2840"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media\/48"}],"wp:attachment":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media?parent=1769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/categories?post=1769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/tags?post=1769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}