{"id":126,"date":"2019-09-01T11:42:05","date_gmt":"2019-09-01T03:42:05","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=126"},"modified":"2020-09-27T17:04:19","modified_gmt":"2020-09-27T09:04:19","slug":"arduino%e5%bc%80%e5%85%b3%e6%8c%89%e9%94%ae%e5%92%8c%e5%bb%b6%e6%97%b6%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=126","title":{"rendered":"Arduino\u5f00\u5173\u6309\u952e\u548c\u5ef6\u65f6\u529f\u80fd"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>void setup() {\n  pinMode(13, OUTPUT);\n  pinMode(2, INPUT);\n}\n \nvoid loop() {\n  boolean val = true; \n  unsigned long showtime = millis();\n  while(true){ \n    unsigned long nowtime = millis();\n    if (digitalRead(2)) {\n      showtime = nowtime + 3000;\n    }\n    if (nowtime &lt;  showtime) {\n      digitalWrite(13, HIGH);\n    } else {\n      digitalWrite(13, LOW);\n    } \n    val = !val;\n    delay(100);\n  }  \n}<\/code><\/pre>\n\n\n\n<p>LED\u63a51K\u7535\u963b\uff0c\u5206\u522b\u63a5GND\u548c13\u53f7\u53e3<\/p>\n\n\n\n<p>\u5f00\u5173\u63a510K\u7535\u963b\uff0c\u5206\u522b\u63a5GND\uff0cVCC\uff0c2\u53f7\u53e3<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2020\/09\/img_5f705593b757b.png\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>LED\u63a51K\u7535\u963b\uff0c\u5206\u522b\u63a5GND\u548c13\u53f7\u53e3 \u5f00\u5173\u63a510K\u7535\u963b\uff0c\u5206\u522b\u63a5GND\uff0cVCC\uff0c2\u53f7\u53e3<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/126"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=126"}],"version-history":[{"count":2,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/126\/revisions"}],"predecessor-version":[{"id":2670,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/126\/revisions\/2670"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}