{"id":374,"date":"2025-07-02T19:06:16","date_gmt":"2025-07-02T10:06:16","guid":{"rendered":"https:\/\/logres.irietec.com\/?p=374"},"modified":"2025-07-02T19:06:16","modified_gmt":"2025-07-02T10:06:16","slug":"374","status":"publish","type":"post","link":"https:\/\/logres.irietec.com\/?p=374","title":{"rendered":""},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">include<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">define BTN_S 2<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">define BTN_1 3<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">define BTN_2 4<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">define BTN_3 5<\/h1>\n\n\n\n<p>\/\/ \u524d\u56de\u306e\u72b6\u614b\u3092\u4fdd\u6301\u3059\u308b\u5909\u6570<br>bool lastStateS = HIGH;<br>bool lastState1 = HIGH;<br>bool lastState2 = HIGH;<br>bool lastState3 = HIGH;<\/p>\n\n\n\n<p>void setup() {<br>pinMode(BTN_S, INPUT_PULLUP);<br>pinMode(BTN_1, INPUT_PULLUP);<br>pinMode(BTN_2, INPUT_PULLUP);<br>pinMode(BTN_3, INPUT_PULLUP);<\/p>\n\n\n\n<p>Keyboard.begin();<br>}<\/p>\n\n\n\n<p>void loop() {<br>\/\/ \u5404\u30dc\u30bf\u30f3\u306e\u73fe\u5728\u306e\u72b6\u614b\u3092\u53d6\u5f97<br>bool currentS = digitalRead(BTN_S);<br>bool current1 = digitalRead(BTN_1);<br>bool current2 = digitalRead(BTN_2);<br>bool current3 = digitalRead(BTN_3);<\/p>\n\n\n\n<p>\/\/ \u30dc\u30bf\u30f3\u304c\u96e2\u3055\u308c\u305f\u3068\u304d\uff08\u524d\u56deLOW \u2192 \u4eca\u56deHIGH\uff09<br>if (lastStateS == LOW &amp;&amp; currentS == HIGH) {<br>Keyboard.press(&#8216;s&#8217;);<br>delay(10);<br>Keyboard.release(&#8216;s&#8217;);<br>}<br>if (lastState1 == LOW &amp;&amp; current1 == HIGH) {<br>Keyboard.press(&#8216;1&#8217;);<br>delay(10);<br>Keyboard.release(&#8216;1&#8217;);<br>}<br>if (lastState2 == LOW &amp;&amp; current2 == HIGH) {<br>Keyboard.press(&#8216;2&#8217;);<br>delay(10);<br>Keyboard.release(&#8216;2&#8217;);<br>}<br>if (lastState3 == LOW &amp;&amp; current3 == HIGH) {<br>Keyboard.press(&#8216;3&#8217;);<br>delay(10);<br>Keyboard.release(&#8216;3&#8217;);<br>}<\/p>\n\n\n\n<p>\/\/ \u524d\u56de\u306e\u72b6\u614b\u3092\u66f4\u65b0<br>lastStateS = currentS;<br>lastState1 = current1;<br>lastState2 = current2;<br>lastState3 = current3;<\/p>\n\n\n\n<p>delay(5); \/\/ \u30c1\u30e3\u30bf\u30ea\u30f3\u30b0\u5bfe\u7b56\uff06CPU\u8ca0\u8377\u8efd\u6e1b<br>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>include define BTN_S 2 define BTN_1 3 define BTN_2 4 define BTN_3 5 \/\/ \u524d\u56de\u306e\u72b6\u614b\u3092\u4fdd\u6301\u3059\u308b\u5909\u6570bool lastStateS = HIGH;bool [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"vkexunit_cta_each_option":"","footnotes":""},"categories":[24],"tags":[],"class_list":["post-374","post","type-post","status-publish","format-standard","hentry","category-basic"],"_links":{"self":[{"href":"https:\/\/logres.irietec.com\/index.php?rest_route=\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logres.irietec.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/logres.irietec.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/logres.irietec.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/logres.irietec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=374"}],"version-history":[{"count":1,"href":"https:\/\/logres.irietec.com\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":375,"href":"https:\/\/logres.irietec.com\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions\/375"}],"wp:attachment":[{"href":"https:\/\/logres.irietec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/logres.irietec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logres.irietec.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}