{"id":805,"date":"2017-08-02T21:59:30","date_gmt":"2017-08-02T13:59:30","guid":{"rendered":"http:\/\/www.rotor.com.tw\/?p=805"},"modified":"2017-10-24T23:10:19","modified_gmt":"2017-10-24T15:10:19","slug":"2017-08-02-arduino-thingspeak","status":"publish","type":"post","link":"https:\/\/www.rotor.com.tw\/?p=805","title":{"rendered":"Arduino + W5100 \u6536\u96c6\u8cc7\u6599\u4e0a\u50b3\u5230 ThingSpeak \u7bc4\u4f8b"},"content":{"rendered":"<p style=\"text-align: center;\">\u6709\u4e00\u9663\u5b50\u6c92\u6709\u7de8\u5bebArduino\u6587\u7ae0<\/p>\n<p style=\"text-align: center;\">\u4eca\u5929\u6709\u6642\u9593\u5c31\u9032\u884cArduino\u6587\u7ae0\u7de8\u5beb<\/p>\n<p style=\"text-align: center;\">\u5e6b\u81ea\u5df1\u505a\u500b\u7d00\u9304\uff0c\u4e5f\u63d0\u4f9b\u60f3\u5b78\u7fd2\u7684\u670b\u53cb\u53c3\u8003<\/p>\n<p style=\"text-align: center;\">\u6b64\u6b21\u4f7f\u7528R3\u677f\u52a0\u4e0aW5100(\u7db2\u8def\u7dda)\u9032\u884c\u5be6\u4f5c<\/p>\n<p style=\"text-align: center;\">\u7db2\u8def\u4e0a\u591a\u6578\u4f7f\u7528ESP8266(wifi)\u9032\u884c\u8cc7\u6599\u50b3\u8f38<\/p>\n<p style=\"text-align: center;\">\u4e0d\u7ba1\u54ea\u4e00\u7a2e\u90fd\u53ef\u4e0a\u50b3\u8cc7\u6599\u5230ThingSpeak<\/p>\n<p style=\"text-align: center;\">\u6700\u5f8c\u7d50\u679c\u5982\u4e0b\u5716<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?ssl=1\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-806\" src=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?resize=584%2C193&#038;ssl=1\" alt=\"thingspeak%e8%b3%87%e6%96%99\" width=\"584\" height=\"193\" srcset=\"https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?w=1551&amp;ssl=1 1551w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?resize=300%2C99&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?resize=768%2C254&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?resize=1024%2C338&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?resize=500%2C165&amp;ssl=1 500w, https:\/\/i0.wp.com\/www.rotor.com.tw\/wp-content\/uploads\/2017\/08\/ThingSpeak\u8cc7\u6599.jpg?w=1168&amp;ssl=1 1168w\" sizes=\"(max-width: 584px) 100vw, 584px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><!--more--><\/p>\n<p style=\"text-align: center;\">\u9996\u5148\u8acb\u5404\u4f4d\u5230<a href=\"https:\/\/thingspeak.com\/\" target=\"_blank\">ThingSpeak<\/a>\u7db2\u7ad9\u4e0a\u8a3b\u518a<\/p>\n<p style=\"text-align: center;\">\u4e26\u53d6\u5f97Channel ID&amp;API Key<\/p>\n<p style=\"text-align: center;\">\u5982\u4e0d\u6e05\u695a\uff0c\u7db2\u8def\u4e0a\u6709\u5f88\u591a\u95dc\u65bcThingSpeak\u8a3b\u518a\u6559\u5b78\uff0c\u53ef\u4f9b\u53c3\u8003<\/p>\n<p style=\"text-align: center;\">\u4e0b\u9762\u70baArduino\u7a0b\u5f0f\u78bc<\/p>\n<p>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;\u958b\u59cb&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n#include &#8220;ThingSpeak.h&#8221;<br \/>\n#include &#8220;Ethernet.h&#8221;<\/p>\n<p>unsigned long myChannelNumber = 311000 ;\/\/\u8acb\u6539\u70ba\u81ea\u5df1\u7684Channel ID<br \/>\nconst char * myWriteAPIKey = &#8220;X8XXXP1OAAA07UY1&#8221;;\/\/\u8acb\u6539\u70ba\u81ea\u5df1\u7684API Key<br \/>\nstatic byte mac[] = { 0xF0, 0x7B, 0xCB, 0x4B, 0x7C, 0x9F }; \/\/mac \u53ef\u4ee5\u81ea\u884c\u66f4\u6539<br \/>\nEthernetClient client;<\/p>\n<p>void setup() {<br \/>\nEthernet.begin(mac);<br \/>\nThingSpeak.begin(client);<br \/>\n}<\/p>\n<p>void loop() {<br \/>\nfloat pinVoltage0 = analogRead(A0); \/\/\u7531A0\u53d6\u5f97\u8cc7\u6599<br \/>\nfloat pinVoltage1 = analogRead(1);<br \/>\nThingSpeak.setField(1,pinVoltage0);<br \/>\npinVoltage0 = analogRead(1); \/\/\u7531A1\u53d6\u5f97\u8cc7\u6599<br \/>\nThingSpeak.setField(2,pinVoltage1);<br \/>\nThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);<\/p>\n<p>delay(20000);<br \/>\n\/\/ \u4e0a\u50b3\u8cc7\u6599\u9593\u969420\u79d2\uff0c\u8acb\u6ce8\u610f\u5230ThingSpeak\u514d\u8cbb\u7528\u6236\u5141\u8a31\u66f4\u65b0\u983b\u7387\u70ba\u6bcf15\u79d2\u4e00\u7b46<br \/>\n}<\/p>\n<p>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;\u7d50\u675f&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p style=\"text-align: center;\">\u5927\u81f4\u4e0a\u53ea\u9700\u8981\u4fee\u6539<\/p>\n<p style=\"text-align: center;\">myChannelNumber &amp; myWriteAPIKey \u9019\u5169\u500b\u5730\u65b9\u5c31\u53ef\u4ee5\u4f7f\u7528<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4e00\u9663\u5b50\u6c92\u6709\u7de8\u5bebArduino\u6587\u7ae0 \u4eca\u5929\u6709\u6642\u9593\u5c31\u9032\u884cArduino\u6587\u7ae0\u7de8\u5beb \u5e6b\u81ea &hellip; <a href=\"https:\/\/www.rotor.com.tw\/?p=805\">\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\/805"}],"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=805"}],"version-history":[{"count":8,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/805\/revisions"}],"predecessor-version":[{"id":837,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/805\/revisions\/837"}],"wp:attachment":[{"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rotor.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}