
{"id":892,"date":"2016-05-30T16:49:15","date_gmt":"2016-05-30T08:49:15","guid":{"rendered":"https:\/\/www.webteach.tw\/?p=892"},"modified":"2016-05-30T16:49:15","modified_gmt":"2016-05-30T08:49:15","slug":"%e4%ba%ba%e9%ab%94%e6%84%9f%e6%87%89%e7%87%88","status":"publish","type":"post","link":"https:\/\/www.webteach.tw\/?p=892","title":{"rendered":"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8"},"content":{"rendered":"<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div><div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div><p>\t\t\t\t\u529f\u80fd\u8aaa\u660e\uff1a\u7576\u6709\u4eba\u7d93\u904e\u5c31\u900f\u904e\u7e7c\u96fb\u5668\u6253\u958b LED \u71c8\uff0c\u5229\u7528\u5149\u654f\u96fb\u963b\u5224\u65b7\u76ee\u524d\u70ba\u767d\u5929\u9084\u662f\u665a\u4e0a\uff0c\u767d\u5929\u5c31\u4e0d\u5075\u6e2c\u3002<br \/>\n[javascript]<br \/>\nconst byte PIR = 3;<br \/>\nconst byte CDS = A7;<br \/>\nconst byte LED = 2;<br \/>\nconst byte RELAY = 4;<br \/>\nunsigned long waiting = 1000;<br \/>\nint minlight = 20;<br \/>\nboolean check_body = false;<br \/>\nvoid setup(){<br \/>\n  Serial.begin(9600);<br \/>\n  pinMode(PIR, INPUT);<br \/>\n  pinMode(CDS, INPUT);<br \/>\n  pinMode(LED, OUTPUT);<br \/>\n  pinMode(RELAY, OUTPUT);<br \/>\n  digitalWrite(RELAY,LOW );<br \/>\n}<br \/>\nvoid loop(){<br \/>\n  int get_cds = analogRead(CDS);<br \/>\n  Serial.println(get_cds);<br \/>\n  if (get_cds &lt; minlight){<br \/>\n    check_body = digitalRead(PIR);<br \/>\n    if(check_body == true){<br \/>\n        digitalWrite(RELAY,HIGH );<br \/>\n        waiting = 120000;<br \/>\n    }else{<br \/>\n        digitalWrite(RELAY,LOW);<br \/>\n        waiting = 1000;<br \/>\n    }<br \/>\n    Serial.println(check_body);<br \/>\n    digitalWrite(LED, HIGH);<br \/>\n  }else{<br \/>\n    digitalWrite(LED, LOW);<br \/>\n    digitalWrite(RELAY,LOW);<br \/>\n    check_body = false;<br \/>\n  }<br \/>\n  Serial.println(waiting);<br \/>\n  delay(waiting);<br \/>\n}<br \/>\n[\/javascript]<br \/>\n\u6240\u4f7f\u7528\u7684\u6750\u6599\uff1a<br \/>\n NANO \u4e3b\u6a5f\u677f \u4e00\u500b<br \/>\n NANO \u64f4\u5c55\u677f \u4e00\u500b<br \/>\n \u7e7c\u96fb\u5668 \u4e00\u500b<br \/>\n \u4eba\u9ad4\u7d05\u5916\u7dda\u611f\u61c9\u6a21\u7d44 \u4e00\u500b<br \/>\n \u5149\u654f\u96fb\u963b \u4e00\u500b<br \/>\n 9V1A \u8b8a\u58d3\u5668 \u4e00\u500b<br \/>\n USB \u6bcd\u5ea7 \u675c\u90a6\u63a5\u982d \u4e00\u500b<br \/>\n LED \u5169\u500b<br \/>\n \u96fb\u7d44 \u5169\u500b<\/p>\n<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div>","protected":false},"excerpt":{"rendered":"<p>\u529f\u80fd\u8aaa\u660e\uff1a\u7576\u6709\u4eba\u7d93\u904e\u5c31\u900f\u904e\u7e7c\u96fb\u5668\u6253\u958b L [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","footnotes":""},"categories":[19],"tags":[661],"class_list":["post-892","post","type-post","status-publish","format-standard","hentry","category-arduino","tag-661"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8 - \u6df7\u6c34\u6478\u9b5a<\/title>\n<meta name=\"description\" content=\"\u4eba\u9ad4\u611f\u61c9\u71c8\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webteach.tw\/?p=892\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8 - \u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"og:description\" content=\"\u4eba\u9ad4\u611f\u61c9\u71c8\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webteach.tw\/?p=892\" \/>\n<meta property=\"og:site_name\" content=\"\u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-30T08:49:15+00:00\" \/>\n<meta name=\"author\" content=\"jeff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005:\" \/>\n\t<meta name=\"twitter:data1\" content=\"jeff\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=892#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=892\"},\"author\":{\"name\":\"jeff\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"headline\":\"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8\",\"datePublished\":\"2016-05-30T08:49:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=892\"},\"wordCount\":107,\"commentCount\":1,\"keywords\":[\"\u4eba\u9ad4\u611f\u61c9\u71c8\"],\"articleSection\":[\"Arduino\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=892#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=892\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/?p=892\",\"name\":\"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8 - \u6df7\u6c34\u6478\u9b5a\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#website\"},\"datePublished\":\"2016-05-30T08:49:15+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"description\":\"\u4eba\u9ad4\u611f\u61c9\u71c8\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=892#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=892\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=892#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\\\/\\\/www.webteach.tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#website\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/\",\"name\":\"\u6df7\u6c34\u6478\u9b5a\",\"description\":\"\u5b78\u7121\u6b62\u5883,\u6559\u5b78\u76f8\u9577\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.webteach.tw\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\",\"name\":\"jeff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"caption\":\"jeff\"},\"sameAs\":[\"http:\\\/\\\/35.72.55.111\"],\"url\":\"https:\\\/\\\/www.webteach.tw\\\/?author=1\"},false]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8 - \u6df7\u6c34\u6478\u9b5a","description":"\u4eba\u9ad4\u611f\u61c9\u71c8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webteach.tw\/?p=892","og_locale":"zh_TW","og_type":"article","og_title":"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8 - \u6df7\u6c34\u6478\u9b5a","og_description":"\u4eba\u9ad4\u611f\u61c9\u71c8","og_url":"https:\/\/www.webteach.tw\/?p=892","og_site_name":"\u6df7\u6c34\u6478\u9b5a","article_published_time":"2016-05-30T08:49:15+00:00","author":"jeff","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005:":"jeff","\u9810\u4f30\u95b1\u8b80\u6642\u9593":"1 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webteach.tw\/?p=892#article","isPartOf":{"@id":"https:\/\/www.webteach.tw\/?p=892"},"author":{"name":"jeff","@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"headline":"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8","datePublished":"2016-05-30T08:49:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webteach.tw\/?p=892"},"wordCount":107,"commentCount":1,"keywords":["\u4eba\u9ad4\u611f\u61c9\u71c8"],"articleSection":["Arduino"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webteach.tw\/?p=892#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webteach.tw\/?p=892","url":"https:\/\/www.webteach.tw\/?p=892","name":"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8 - \u6df7\u6c34\u6478\u9b5a","isPartOf":{"@id":"https:\/\/www.webteach.tw\/#website"},"datePublished":"2016-05-30T08:49:15+00:00","author":{"@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"description":"\u4eba\u9ad4\u611f\u61c9\u71c8","breadcrumb":{"@id":"https:\/\/www.webteach.tw\/?p=892#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webteach.tw\/?p=892"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webteach.tw\/?p=892#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/www.webteach.tw\/"},{"@type":"ListItem","position":2,"name":"[ Arduino ] \u2013 \u53ef\u662f\u745e\u51e1\u4e4b-\u667a\u6167\u611f\u5149 +\u4eba\u9ad4\u611f\u61c9\u71c8"}]},{"@type":"WebSite","@id":"https:\/\/www.webteach.tw\/#website","url":"https:\/\/www.webteach.tw\/","name":"\u6df7\u6c34\u6478\u9b5a","description":"\u5b78\u7121\u6b62\u5883,\u6559\u5b78\u76f8\u9577","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webteach.tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Person","@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520","name":"jeff","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","caption":"jeff"},"sameAs":["http:\/\/35.72.55.111"],"url":"https:\/\/www.webteach.tw\/?author=1"},false]}},"views":848,"yasr_visitor_votes":{"stars_attributes":{"read_only":false,"span_bottom":false},"number_of_votes":0,"sum_votes":0},"_links":{"self":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=892"}],"version-history":[{"count":0,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/892\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}