{"id":816,"date":"2017-08-13T14:13:53","date_gmt":"2017-08-13T06:13:53","guid":{"rendered":"http:\/\/www.rotor.com.tw\/?p=816"},"modified":"2017-10-24T23:10:15","modified_gmt":"2017-10-24T15:10:15","slug":"arduino-w5100-%e7%94%b1thingspeak-%e5%8f%96%e5%9b%9e%e8%b3%87%e6%96%99-%e7%af%84%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.rotor.com.tw\/?p=816","title":{"rendered":"Arduino + W5100 \u7531ThingSpeak \u53d6\u56de\u8cc7\u6599 \u7bc4\u4f8b"},"content":{"rendered":"<p style=\"text-align: center;\">\u4eca\u5929\u7684\u4e3b\u984c\u7531\u4e0a\u4e00\u7bc7\u5ef6\u4f38\u51fa\u4f86<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.rotor.com.tw\/?p=805\">Arduino + W5100 \u6536\u96c6\u8cc7\u6599\u4e0a\u50b3\u5230 ThingSpeak \u7bc4\u4f8b<\/a><\/p>\n<p style=\"text-align: center;\">\u4e0a\u4e00\u7bc7\u4f7f\u7528&#8221;ThingSpeak.h&#8221; \u00a0library\u9032\u884c\u8cc7\u6599\u4e0a\u50b3<\/p>\n<p style=\"text-align: center;\">\u672c\u6b21\u4f9d\u7136\u4f7f\u7528&#8221;ThingSpeak.h&#8221;\u9019\u500blibrary\u53d6\u56de\u8cc7\u6599<\/p>\n<p style=\"text-align: center;\">\u6b64\u6b21\u4f7f\u7528R3\u677f\u52a0\u4e0aW5100\u9032\u884c\u5be6\u4f5c<\/p>\n<p style=\"text-align: center;\">\u5728\u5be6\u4f5c\u4e4b\u524d\u8acb\u5148\u53d6\u5f97\u5169\u9805\u8cc7\u8a0a<\/p>\n<p style=\"text-align: center;\"><!--more--><\/p>\n<p style=\"text-align: center;\">\u7b2c\u4e00\u9805 \u00a0Channel ID<\/p>\n<p style=\"text-align: center;\">\u7b2c\u4e8c\u9805 \u00a0Read API Keys<\/p>\n<p style=\"text-align: center;\">\u4e0a\u8ff0\u5169\u9805\u8cc7\u8a0a\u8acb\u7531ThingSpeak\u53d6\u5f97<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/channel-ID.jpg?ssl=1\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-818\" src=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/channel-ID.jpg?resize=584%2C256&#038;ssl=1\" alt=\"channel-id\" width=\"584\" height=\"256\" srcset=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/channel-ID.jpg?w=1209&amp;ssl=1 1209w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/channel-ID.jpg?resize=300%2C132&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/channel-ID.jpg?resize=768%2C337&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/channel-ID.jpg?resize=1024%2C450&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/channel-ID.jpg?resize=500%2C220&amp;ssl=1 500w\" sizes=\"(max-width: 584px) 100vw, 584px\" data-recalc-dims=\"1\" \/><\/a> <a href=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/APIKey-1.jpg?ssl=1\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-819 aligncenter\" src=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/APIKey-1.jpg?resize=584%2C358&#038;ssl=1\" alt=\"apikey\" width=\"584\" height=\"358\" srcset=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/APIKey-1.jpg?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/APIKey-1.jpg?resize=300%2C184&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/APIKey-1.jpg?resize=768%2C471&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/APIKey-1.jpg?resize=489%2C300&amp;ssl=1 489w\" sizes=\"(max-width: 584px) 100vw, 584px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p style=\"text-align: center;\">\u53d6\u5f97\u4e0a\u8ff0\u5169\u9805\u8cc7\u6599\u5f8c<\/p>\n<p style=\"text-align: center;\">\u5e36\u5165\u4e0b\u9762\u7a0b\u5f0f\u78bc\u5373\u53ef<\/p>\n<p style=\"text-align: left;\">\/\/\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<br \/>\n\/\/\u2014\u2014\u2014\u2014\u2014\u958b\u59cb\u2014\u2014\u2014\u2014\u2013<br \/>\n\/\/\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<\/p>\n<p>#include &#8220;ThingSpeak.h&#8221;<br \/>\n#include &#8220;Ethernet.h&#8221;<\/p>\n<p>unsigned long myChannelNumber = XXXXXXX;\/\/\u8acb\u586b\u5165Channel ID<br \/>\nconst char * myReadAPIKey = &#8220;XXXXXXXX&#8221;;\/\/\u8acb\u586b\u5165Read API Keys<br \/>\nbyte mac[] = { 0xF0, 0x7B, 0xCB, 0x4B, 0x7C, 0x9F }; \/\/<br \/>\nEthernetClient client;<br \/>\nint LEDPin7 = 7;<br \/>\nvoid setup() {<br \/>\nSerial.begin(9600);<br \/>\nEthernet.begin(mac);<br \/>\nThingSpeak.begin(client);<br \/>\npinMode(LEDPin7, OUTPUT);<br \/>\n\/\/\u96fb\u6e90\u958b\u555f\u6642\uff0c\u6703\u9032\u884c\u958b\u6a5f\u81ea\u6211\u6aa2\u6e2cPOST \u5168\u540d\u70baPower ON Self Test<br \/>\nSerial.print(&#8220;POST&#8230;&#8230;..&#8221;);<br \/>\ndigitalWrite(LEDPin7, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(LEDPin7, LOW);<br \/>\ndelay(500);<br \/>\nSerial.println(&#8220;Finish&#8221;);<br \/>\n}<\/p>\n<p>void loop() {<br \/>\nfloat Field_1 = ThingSpeak.readFloatField(myChannelNumber, 1, myReadAPIKey);<br \/>\nSerial.print(&#8220;Read ThingSpeak Field 1 Val =&#8221;);<br \/>\nSerial.println(Field_1);<br \/>\n\/\/\u5982\u679c\u53d6\u56de\u7684\u503c\u70ba0,LED\u4e0d\u4eae<br \/>\nif (Field_1 == 0){<br \/>\ndigitalWrite(LEDPin7, LOW);<br \/>\n}<br \/>\n\/\/\u5982\u679c\u53d6\u56de\u7684\u503c\u70ba1,LED\u9ede\u4eae<br \/>\nelse if(Field_1 == 1){<br \/>\ndigitalWrite(LEDPin7, HIGH);<br \/>\n}<br \/>\ndelay(1000);<br \/>\n}<\/p>\n<p>\/\/\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<br \/>\n\/\/\u2014\u2014\u2014\u2014\u2014\u7d50\u675f\u2014\u2014\u2014\u2014\u2013<br \/>\n\/\/\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/20170813_code.rar\" target=\"_blank\">\u7bc4\u4f8b\u6a94\u6848\u4e0b\u8f09<\/a><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\">\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u7684\u4e3b\u984c\u7531\u4e0a\u4e00\u7bc7\u5ef6\u4f38\u51fa\u4f86 Arduino + W5100 \u6536\u96c6\u8cc7\u6599\u4e0a\u50b3\u5230 Th &hellip; <a href=\"https:\/\/www.rotor.com.tw\/?p=816\">\u95b1\u8b80\u5168\u6587 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":56,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false},"categories":[19],"tags":[22,23],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/816"}],"collection":[{"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=816"}],"version-history":[{"count":1,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/816\/revisions"}],"predecessor-version":[{"id":821,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/816\/revisions\/821"}],"wp:attachment":[{"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}