
{"id":812,"date":"2016-03-01T12:32:18","date_gmt":"2016-03-01T04:32:18","guid":{"rendered":"https:\/\/www.webteach.tw\/?p=812"},"modified":"2016-03-01T12:32:18","modified_gmt":"2016-03-01T04:32:18","slug":"arduino-fade-led-%e5%bf%bd%e6%98%8e%e5%bf%bd%e6%9a%97%e7%9a%84-led-%e7%87%88","status":"publish","type":"post","link":"https:\/\/www.webteach.tw\/?p=812","title":{"rendered":"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \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\u958b\u555f fade \u7bc4\u4f8b\u7a0b\u5f0f<br \/>\n<a href=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png\" rel=\"attachment wp-att-813\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png\" alt=\"fade\" width=\"853\" height=\"738\" class=\"alignleft size-full wp-image-813\" srcset=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png 853w, https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade-300x260.png 300w, https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade-768x664.png 768w\" sizes=\"auto, (max-width: 853px) 100vw, 853px\" \/><\/a><br \/>\n\u7d05\u8272\u6b63\u6975 \u63d2\u5165 \u8173\u4f4d 9 \u85cd\u8272 \u8ca0\u6975 \u63d2\u5165 GND\u63a5\u5730\u7dda<br \/>\n<a href=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/IMG_20160301_120030-scaled-1.jpg\" rel=\"attachment wp-att-815\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/IMG_20160301_120030-1024x544.jpg\" alt=\"IMG_20160301_120030\" width=\"1024\" height=\"544\" class=\"alignleft size-large wp-image-815\" \/><\/a><br \/>\n\u9eb5\u5305\u677f\u4e0a \u7d05\u8272\u63d2\u5165\u6b63\u6975 \u85cd\u8272 \u63d2\u5165 \u8ca0\u6975 LED \u9577\u8173\u4f4d\u63d2\u5165\u6b63\u6975 \u77ed\u8173\u4f4d\u63d2\u5165\u8ca0\u6975<br \/>\n<a href=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/IMG_20160301_120038.jpg\" rel=\"attachment wp-att-816\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/IMG_20160301_120038-1024x818.jpg\" alt=\"IMG_20160301_120038\" width=\"1024\" height=\"818\" class=\"alignleft size-large wp-image-816\" \/><\/a><br \/>\n\u7a0b\u5f0f\u90e8\u4efd<br \/>\n[java]<br \/>\n\/*<br \/>\n Fade<br \/>\n This example shows how to fade an LED on pin 9<br \/>\n using the analogWrite() function.<br \/>\n The analogWrite() function uses PWM, so if<br \/>\n you want to change the pin you&#8217;re using, be<br \/>\n sure to use another PWM capable pin. On most<br \/>\n Arduino, the PWM pins are identified with<br \/>\n a &quot;~&quot; sign, like ~3, ~5, ~6, ~9, ~10 and ~11.<br \/>\n This example code is in the public domain.<br \/>\n *\/<br \/>\nint led = 9;           \/\/ the PWM pin the LED is attached to<br \/>\nint brightness = 0;    \/\/ how bright the LED is<br \/>\nint fadeAmount = 5;    \/\/ how many points to fade the LED by \u8acb\u8a66\u8457\u4fee\u6539\u9019\u500b\u503c<br \/>\n\/\/ the setup routine runs once when you press reset:<br \/>\nvoid setup() {<br \/>\n  \/\/ declare pin 9 to be an output:<br \/>\n  pinMode(led, OUTPUT);<br \/>\n}<br \/>\n\/\/ the loop routine runs over and over again forever:<br \/>\nvoid loop() {<br \/>\n  \/\/ set the brightness of pin 9:<br \/>\n  analogWrite(led, brightness);<br \/>\n  \/\/ change the brightness for next time through the loop:<br \/>\n  brightness = brightness + fadeAmount;<br \/>\n  \/\/ reverse the direction of the fading at the ends of the fade:<br \/>\n  if (brightness == 0 || brightness == 255) {<br \/>\n    fadeAmount = -fadeAmount ;<br \/>\n  }<br \/>\n  \/\/ wait for 30 milliseconds to see the dimming effect<br \/>\n  delay(30);<br \/>\n}<br \/>\n[\/java]<br \/>\n\u57f7\u884c\u5f71\u7247<br \/>\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/tGs9nl_ET_0\" frameborder=\"0\" allowfullscreen><\/iframe>\t\t<\/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>\u958b\u555f fade \u7bc4\u4f8b\u7a0b\u5f0f \u7d05\u8272\u6b63\u6975 \u63d2\u5165 [&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":[250],"class_list":["post-812","post","type-post","status-publish","format-standard","hentry","category-arduino","tag-fade"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8 - \u6df7\u6c34\u6478\u9b5a<\/title>\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=812\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8 - \u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"og:description\" content=\"\u958b\u555f fade \u7bc4\u4f8b\u7a0b\u5f0f \u7d05\u8272\u6b63\u6975 \u63d2\u5165 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webteach.tw\/?p=812\" \/>\n<meta property=\"og:site_name\" content=\"\u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-01T04:32:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png\" \/>\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=812#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812\"},\"author\":{\"name\":\"jeff\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"headline\":\"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8\",\"datePublished\":\"2016-03-01T04:32:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812\"},\"wordCount\":175,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/fade.png\",\"keywords\":[\"fade\"],\"articleSection\":[\"Arduino\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=812#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812\",\"name\":\"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8 - \u6df7\u6c34\u6478\u9b5a\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/fade.png\",\"datePublished\":\"2016-03-01T04:32:18+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=812\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812#primaryimage\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/fade.png\",\"contentUrl\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/fade.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=812#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\\\/\\\/www.webteach.tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \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 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8 - \u6df7\u6c34\u6478\u9b5a","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=812","og_locale":"zh_TW","og_type":"article","og_title":"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8 - \u6df7\u6c34\u6478\u9b5a","og_description":"\u958b\u555f fade \u7bc4\u4f8b\u7a0b\u5f0f \u7d05\u8272\u6b63\u6975 \u63d2\u5165 [&hellip;]","og_url":"https:\/\/www.webteach.tw\/?p=812","og_site_name":"\u6df7\u6c34\u6478\u9b5a","article_published_time":"2016-03-01T04:32:18+00:00","og_image":[{"url":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png","type":"","width":"","height":""}],"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=812#article","isPartOf":{"@id":"https:\/\/www.webteach.tw\/?p=812"},"author":{"name":"jeff","@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"headline":"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8","datePublished":"2016-03-01T04:32:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webteach.tw\/?p=812"},"wordCount":175,"commentCount":0,"image":{"@id":"https:\/\/www.webteach.tw\/?p=812#primaryimage"},"thumbnailUrl":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png","keywords":["fade"],"articleSection":["Arduino"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webteach.tw\/?p=812#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webteach.tw\/?p=812","url":"https:\/\/www.webteach.tw\/?p=812","name":"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \u71c8 - \u6df7\u6c34\u6478\u9b5a","isPartOf":{"@id":"https:\/\/www.webteach.tw\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webteach.tw\/?p=812#primaryimage"},"image":{"@id":"https:\/\/www.webteach.tw\/?p=812#primaryimage"},"thumbnailUrl":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png","datePublished":"2016-03-01T04:32:18+00:00","author":{"@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"breadcrumb":{"@id":"https:\/\/www.webteach.tw\/?p=812#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webteach.tw\/?p=812"]}]},{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.webteach.tw\/?p=812#primaryimage","url":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png","contentUrl":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2016\/03\/fade.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.webteach.tw\/?p=812#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/www.webteach.tw\/"},{"@type":"ListItem","position":2,"name":"[ Arduino ] \u2013 Fade LED \u5ffd\u660e\u5ffd\u6697\u7684 LED \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":1530,"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\/812","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=812"}],"version-history":[{"count":0,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/812\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}