{"id":22221,"date":"2018-03-24T17:01:59","date_gmt":"2018-03-24T10:01:59","guid":{"rendered":"http:\/\/tom.ji42.com\/?p=22221"},"modified":"2018-03-24T17:01:59","modified_gmt":"2018-03-24T10:01:59","slug":"%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%83%e0%b8%8a%e0%b9%89-arduino-%e0%b8%a3%e0%b9%88%e0%b8%a7%e0%b8%a1%e0%b8%81%e0%b8%b1%e0%b8%9a-nodemcu-esp8266-2","status":"publish","type":"post","link":"https:\/\/tom.tomwork.net\/?p=22221","title":{"rendered":"\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49 Arduino \u0e23\u0e48\u0e27\u0e21\u0e01\u0e31\u0e1a NodeMCU\/ESP8266"},"content":{"rendered":"<p>\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u00a0<a href=\"https:\/\/www.arduinothai.com\/category\/52\/arduino-compatible-board\/single-set\">Arduino<\/a>\u00a0\u0e23\u0e48\u0e27\u0e21\u0e01\u0e31\u0e1a\u00a0<a href=\"https:\/\/www.arduinothai.com\/category\/70\/arduino-modules-shield\/internet-esp8266\/internet-modules\">NodeMCU\/ESP8266<\/a>\u00a0\u0e08\u0e30\u0e21\u0e35\u0e14\u0e49\u0e27\u0e22\u0e01\u0e31\u0e19\u0e2b\u0e25\u0e32\u0e22\u0e41\u0e1a\u0e1a \u0e40\u0e0a\u0e48\u0e19 I2C, Serial \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e40\u0e1e\u0e34\u0e48\u0e21 I\/O \u0e40\u0e0a\u0e48\u0e19\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e02\u0e32 digital, \u0e02\u0e32 analog\u00a0\u0e43\u0e19\u0e17\u0e35\u0e48\u0e19\u0e35\u0e49\u0e08\u0e30\u0e22\u0e01\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e01\u0e32\u0e23\u0e2a\u0e37\u0e48\u0e2d\u0e2a\u0e32\u0e23\u0e41\u0e1a\u0e1a Serial \u0e01\u0e48\u0e2d\u0e19\u0e40\u0e1e\u0e23\u0e32\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e17\u0e35\u0e48\u0e07\u0e48\u0e32\u0e22\u0e15\u0e48\u0e2d\u0e01\u0e32\u0e23\u0e40\u0e02\u0e49\u0e32\u0e43\u0e08\u00a0\u0e43\u0e19\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e2a\u0e48\u0e07\u0e04\u0e48\u0e32\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07 Arduino \u0e01\u0e31\u0e1a NodeMCU \u0e42\u0e14\u0e22\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e43\u0e2b\u0e49 Arduino \u0e2a\u0e48\u0e07\u0e04\u0e48\u0e32 int (\u0e08\u0e33\u0e19\u0e27\u0e19\u0e40\u0e15\u0e47\u0e21) \u0e41\u0e25\u0e30 float (\u0e17\u0e28\u0e19\u0e34\u0e22\u0e21)\u00a0\u0e44\u0e1b\u0e22\u0e31\u0e07 NodeMCU \u0e42\u0e14\u0e22\u0e2a\u0e21\u0e21\u0e15\u0e34\u0e27\u0e48\u0e32 Arduino \u0e01\u0e33\u0e25\u0e31\u0e07\u0e2a\u0e48\u0e07\u0e04\u0e48\u0e32\u0e2d\u0e30\u0e44\u0e23\u0e1a\u0e32\u0e07\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e33\u0e19\u0e27\u0e19\u0e40\u0e15\u0e47\u0e21 (int) \u0e41\u0e25\u0e30\u0e01\u0e33\u0e25\u0e31\u0e07\u0e2d\u0e48\u0e32\u0e19\u0e04\u0e48\u0e32 Sensor \u0e40\u0e1b\u0e47\u0e19\u0e17\u0e28\u0e19\u0e34\u0e22\u0e21 (float)\u00a0\u0e08\u0e32\u0e01\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07 \u0e40\u0e23\u0e32\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e19\u0e33\u0e04\u0e48\u0e32\u0e17\u0e35\u0e48 NodeMCU \u0e2d\u0e48\u0e32\u0e19\u0e44\u0e14\u0e49\u0e40\u0e1b\u0e47\u0e19 int \u0e41\u0e25\u0e30 float \u0e44\u0e1b\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e44\u0e14\u0e49\u0e40\u0e25\u0e22\u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49\u0e1f\u0e31\u0e07\u0e01\u0e4c\u0e0a\u0e31\u0e48\u0e19\u00a0<a href=\"https:\/\/www.arduino.cc\/en\/Serial\/ParseInt\">parseInt()<\/a>,\u00a0<a href=\"https:\/\/www.arduino.cc\/en\/Serial\/ParseFloat\">parseFloat()<\/a>\u00a0\u0e43\u0e19\u0e2a\u0e48\u0e27\u0e19\u0e02\u0e2d\u0e07\u0e42\u0e04\u0e49\u0e14\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e08\u0e30\u0e21\u0e35\u0e14\u0e49\u0e27\u0e22\u0e01\u0e31\u0e19\u0e2a\u0e2d\u0e07\u0e1d\u0e31\u0e48\u0e07\u0e04\u0e37\u0e2d \u0e1d\u0e31\u0e48\u0e07Arduino \u0e41\u0e25\u0e30 \u0e1d\u0e31\u0e48\u0e07NodeMCU<\/p>\n<p>\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e2b\u0e15\u0e38 \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e01\u0e31\u0e1a Arduino \u0e23\u0e38\u0e48\u0e19\u0e43\u0e14\u0e01\u0e47\u0e44\u0e14\u0e49 \u0e2b\u0e23\u0e37\u0e2d\u0e08\u0e30\u0e40\u0e2d\u0e32\u0e44\u0e1b\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e43\u0e19\u0e01\u0e32\u0e23\u0e40\u0e1e\u0e34\u0e48\u0e21 output \u0e43\u0e2b\u0e49\u0e01\u0e31\u0e1a Nodemcu \u0e01\u0e47\u0e44\u0e14\u0e49<\/p>\n<p><!--more--><\/p>\n<p><strong>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e01\u0e32\u0e23\u0e15\u0e48\u0e2d\u0e27\u0e07\u0e08\u0e23<\/strong><\/p>\n<table border=\"0\">\n<tbody>\n<tr>\n<td><strong>Arduino Nano<\/strong><\/td>\n<td><strong>NodeMCU<\/strong><\/td>\n<\/tr>\n<tr>\n<td>VIN<\/td>\n<td>VIN<\/td>\n<\/tr>\n<tr>\n<td>GND<\/td>\n<td>GND<\/td>\n<\/tr>\n<tr>\n<td>D2<\/td>\n<td>D2<\/td>\n<\/tr>\n<tr>\n<td>D3<\/td>\n<td>D3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img decoding=\"async\" src=\"https:\/\/cq.lnwfile.com\/_\/cq\/_raw\/re\/h7\/f6.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u0e42\u0e04\u0e49\u0e14\u0e1d\u0e31\u0e48\u0e07 Arduino<\/strong><\/p>\n<p>int i_data = 1234;<\/p>\n<p>float f_data = 567.89;<\/p>\n<p>#include &lt;SoftwareSerial.h&gt;<\/p>\n<p>SoftwareSerial NanoSerial(3, 2); \/\/ RX | TX<\/p>\n<p>void setup()<\/p>\n<p>{<\/p>\n<p>pinMode(3,INPUT);<\/p>\n<p>pinMode(2,OUTPUT);<\/p>\n<p>Serial.begin(9600);<\/p>\n<p>NanoSerial.begin(57600);<\/p>\n<p>}<\/p>\n<p>void loop() {<\/p>\n<p>Serial.print(i_data); Serial.print(&#8220;\\t&#8221;);<\/p>\n<p>Serial.println(f_data);<\/p>\n<p>NanoSerial.print(i_data); NanoSerial.print(&#8221; &#8220;);<\/p>\n<p>NanoSerial.print(f_data); NanoSerial.print(&#8220;\\n&#8221;);<\/p>\n<p>delay(100);<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u0e42\u0e04\u0e49\u0e14\u0e1d\u0e31\u0e48\u0e07 NodeMCU\u00a0<\/strong><\/p>\n<p>#include &lt;ESP8266WiFi.h&gt;<\/p>\n<p>#include &lt;SoftwareSerial.h&gt;<\/p>\n<p>SoftwareSerial NodeSerial(D2,D3); \/\/ RX | TX<\/p>\n<p>void setup() {<\/p>\n<p>pinMode(D2, INPUT);<\/p>\n<p>pinMode(D3, OUTPUT);<\/p>\n<p>Serial.begin(9600);<\/p>\n<p>NodeSerial.begin(57600);<\/p>\n<p>Serial.println();<\/p>\n<p>Serial.println();<\/p>\n<p>Serial.println(&#8220;NodeMCU\/ESP8266 Run&#8221;);<\/p>\n<p>}<\/p>\n<p>void loop() {<\/p>\n<p>while (NodeSerial.available() &gt; 0)<\/p>\n<p>{<\/p>\n<p>int i_data = NodeSerial.parseInt();<\/p>\n<p>float f_data = NodeSerial.parseFloat();<\/p>\n<p>if (NodeSerial.read() == &#8216;\\n&#8217;)<\/p>\n<p>{<\/p>\n<p>Serial.print(&#8220;NodeMCU or ESP8266&#8243;); Serial.print(&#8221; : &#8220;);<\/p>\n<p>Serial.print(i_data); Serial.print(&#8221; : &#8220;);<\/p>\n<p>Serial.println(f_data);<\/p>\n<p>}<\/p>\n<p>delay(50);<\/p>\n<p>}<\/p>\n<p>delay(10);<\/p>\n<p>}<\/p>\n<p><strong>\u0e1c\u0e25\u0e01\u0e32\u0e23\u0e17\u0e14\u0e2a\u0e2d\u0e1a<\/strong><\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cq.lnwfile.com\/_\/cq\/_raw\/h7\/cx\/32.jpg\" alt=\"\" width=\"696\" height=\"522\" \/><\/strong><\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cq.lnwfile.com\/_\/cq\/_raw\/vg\/ey\/nf.png\" alt=\"\" width=\"970\" height=\"542\" \/><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u00a0Arduino\u00a0\u0e23\u0e48\u0e27\u0e21\u0e01\u0e31\u0e1a\u00a0NodeMCU\/ESP8266\u00a0\u0e08\u0e30\u0e21\u0e35\u0e14\u0e49\u0e27\u0e22\u0e01\u0e31\u0e19\u0e2b\u0e25\u0e32\u0e22\u0e41\u0e1a\u0e1a \u0e40\u0e0a\u0e48\u0e19 I2C, Serial \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e40\u0e1e\u0e34\u0e48\u0e21 I\/O \u0e40\u0e0a\u0e48\u0e19\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e02\u0e32 digital, \u0e02\u0e32 analog\u00a0\u0e43\u0e19\u0e17\u0e35\u0e48\u0e19\u0e35\u0e49\u0e08\u0e30\u0e22\u0e01\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e01\u0e32\u0e23\u0e2a\u0e37\u0e48\u0e2d\u0e2a\u0e32\u0e23\u0e41\u0e1a\u0e1a Serial \u0e01\u0e48\u0e2d\u0e19\u0e40\u0e1e\u0e23\u0e32\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e17\u0e35\u0e48\u0e07\u0e48\u0e32\u0e22\u0e15\u0e48\u0e2d\u0e01\u0e32\u0e23\u0e40\u0e02\u0e49\u0e32\u0e43\u0e08\u00a0\u0e43\u0e19\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e01\u0e32\u0e23\u0e2a\u0e48\u0e07\u0e04\u0e48\u0e32\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07 Arduino \u0e01\u0e31\u0e1a NodeMCU \u0e42\u0e14\u0e22\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e43\u0e2b\u0e49 Arduino \u0e2a\u0e48\u0e07\u0e04\u0e48\u0e32 int (\u0e08\u0e33\u0e19\u0e27\u0e19\u0e40\u0e15\u0e47\u0e21) \u0e41\u0e25\u0e30 float (\u0e17\u0e28\u0e19\u0e34\u0e22\u0e21)\u00a0\u0e44\u0e1b\u0e22\u0e31\u0e07 NodeMCU \u0e42\u0e14\u0e22\u0e2a\u0e21\u0e21\u0e15\u0e34\u0e27\u0e48\u0e32 Arduino \u0e01\u0e33\u0e25\u0e31\u0e07\u0e2a\u0e48\u0e07\u0e04\u0e48\u0e32\u0e2d\u0e30\u0e44\u0e23\u0e1a\u0e32\u0e07\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e33\u0e19\u0e27\u0e19\u0e40\u0e15\u0e47\u0e21 (int) \u0e41\u0e25\u0e30\u0e01\u0e33\u0e25\u0e31\u0e07\u0e2d\u0e48\u0e32\u0e19\u0e04\u0e48\u0e32 Sensor \u0e40\u0e1b\u0e47\u0e19\u0e17\u0e28\u0e19\u0e34\u0e22\u0e21 (float)\u00a0\u0e08\u0e32\u0e01\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07 \u0e40\u0e23\u0e32\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e19\u0e33\u0e04\u0e48\u0e32\u0e17\u0e35\u0e48 NodeMCU \u0e2d\u0e48\u0e32\u0e19\u0e44\u0e14\u0e49\u0e40\u0e1b\u0e47\u0e19 int \u0e41\u0e25\u0e30 float \u0e44\u0e1b\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e44\u0e14\u0e49\u0e40\u0e25\u0e22\u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49\u0e1f\u0e31\u0e07\u0e01\u0e4c\u0e0a\u0e31\u0e48\u0e19\u00a0parseInt(),\u00a0parseFloat()\u00a0\u0e43\u0e19\u0e2a\u0e48\u0e27\u0e19\u0e02\u0e2d\u0e07\u0e42\u0e04\u0e49\u0e14\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e08\u0e30\u0e21\u0e35\u0e14\u0e49\u0e27\u0e22\u0e01\u0e31\u0e19\u0e2a\u0e2d\u0e07\u0e1d\u0e31\u0e48\u0e07\u0e04\u0e37\u0e2d \u0e1d\u0e31\u0e48\u0e07Arduino \u0e41\u0e25\u0e30 \u0e1d\u0e31\u0e48\u0e07NodeMCU \u0e2b\u0e21\u0e32\u0e22\u0e40\u0e2b\u0e15\u0e38 \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e01\u0e31\u0e1a Arduino \u0e23\u0e38\u0e48\u0e19\u0e43\u0e14\u0e01\u0e47\u0e44\u0e14\u0e49 \u0e2b\u0e23\u0e37\u0e2d\u0e08\u0e30\u0e40\u0e2d\u0e32\u0e44\u0e1b\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e43\u0e19\u0e01\u0e32\u0e23\u0e40\u0e1e\u0e34\u0e48\u0e21 output \u0e43\u0e2b\u0e49\u0e01\u0e31\u0e1a Nodemcu \u0e01\u0e47\u0e44\u0e14\u0e49<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[13],"tags":[219,220],"class_list":["post-22221","post","type-post","status-publish","format-standard","hentry","category-13","tag-arduino","tag-nodemcu"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6cOVM-5Mp","_links":{"self":[{"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=\/wp\/v2\/posts\/22221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22221"}],"version-history":[{"count":1,"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=\/wp\/v2\/posts\/22221\/revisions"}],"predecessor-version":[{"id":22222,"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=\/wp\/v2\/posts\/22221\/revisions\/22222"}],"wp:attachment":[{"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tom.tomwork.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}