{"id":1188,"date":"2018-12-25T19:50:43","date_gmt":"2018-12-25T11:50:43","guid":{"rendered":"https:\/\/swf.com.tw\/?p=1188"},"modified":"2018-12-25T19:50:46","modified_gmt":"2018-12-25T11:50:46","slug":"%e4%bd%bf%e7%94%a8python%e7%9a%84pyserial%e6%a8%a1%e7%b5%84%e9%80%b2%e8%a1%8c%e5%ba%8f%e5%88%97%e9%80%9a%e8%a8%8a%ef%bc%9a%e9%80%a3%e6%8e%a5%e9%9b%bb%e8%85%a6%e8%88%87arduino%e5%92%8cmicropython","status":"publish","type":"post","link":"https:\/\/swf.com.tw\/?p=1188","title":{"rendered":"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython"},"content":{"rendered":"<p>\u9023\u63a5ESP8266\u63a7\u5236\u677f\u548c\u96fb\u8166\u7684\u65b9\u5f0f\u6709\u5169\u7a2e\uff1a<\/p>\n<ul>\n<li><strong>Wi-Fi<\/strong><strong>\u7121\u7dda\u7db2\u8def\uff1a<\/strong>\u628aESP8266\u7576\u4f5c\u611f\u6e2c\u5668\u7db2\u8def\u524d\u7aef\u8a2d\u5099\uff0c\u50b3\u9001\u8cc7\u6599\u5230\u7db2\u7ad9\u4f3a\u670d\u5668\uff1b\u6216\u8005\u7576\u4f5c\u7db2\u7ad9\u4f3a\u670d\u5668\uff0c\u63d0\u4f9bAPI\u8b93\u524d\u7aef\u7db2\u9801\u53d6\u5f97\u611f\u6e2c\u6578\u64da\u3002<\/li>\n<li><strong>\u5e8f\u5217\u901a\u8a0a\u57e0\uff1a<\/strong>\u900f\u904eUSB\u5e8f\u5217\u57e0\u8ddf\u96fb\u8166\u6216\u8005\u624b\u6a5f\u9023\u7dda\u3002<\/li>\n<\/ul>\n<p>\u4f7f\u7528Wi-Fi\u9023\u7dda\u986f\u7136\u6bd4\u8f03\u7b26\u5408ESP8266\u7684\u5929\u6027\uff0c\u4f46\u662f\u5c0d\u65bc\u6c92\u6709\u5167\u5efaWi-Fi\u7684MicroPython\u63a7\u5236\u677f\u6216\u8005Arduino\u677f\uff0cUSB\u662f\u6700\u666e\u904d\u7684\u9078\u64c7\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u4f7f\u7528Python\u7a0b\u5f0f\u8207Arduino\u548cMicroPython\uff08ESP8266\u677f\uff09\u9032\u884c\u5e8f\u5217\u901a\u8a0a\u7684\u65b9\u6cd5\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/books\/micropython\/esp8266_serial.png\" width=\"517\" height=\"172\" alt=\"USB\u5e8f\u5217\u9023\u63a5ESP8266\"\/><\/p>\n<h2>\u4f7f\u7528pySerial\u9032\u884c\u5e8f\u5217\u901a\u8a0a<\/h2>\n<p>Python\u7684\u5e8f\u5217\u57e0\u901a\u8a0a\u5957\u4ef6\u53eb\u505a<a href=\"https:\/\/pypi.org\/project\/pyserial\/\" target=\"_blank\">pySerial<\/a>\uff0c\u8acb\u5728\u7d42\u7aef\u6a5f\u900f\u904epip\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/books\/micropython\/install_pyserial.png\" width=\"710\" height=\"128\" alt=\"\u5b89\u88ddpySerial\"\/><\/p>\n<p><strong>pySerial\u63d0\u4f9b\u521d\u59cb\u5316\u5e8f\u5217\u57e0\u3001\u50b3\u9001\u548c\u63a5\u6536\u5e8f\u5217\u6578\u64da\u7684\u6307\u4ee4\uff0c\u50cfread(), readline()\u548cwrite()\u57fa\u672c\u6307\u4ee4\u540d\u7a31\u548c\u8a9e\u6cd5\uff0c\u8ddfMicroPython\u7684UART\u6a21\u7d44\u4e00\u6a23\u3002<\/strong>\u4e00\u958b\u59cb\uff0c\u6211\u5011\u5148\u5f9eArduino\u50b3\u9001\u5e8f\u5217\u8cc7\u6599\u7d66Python\u63a5\u6536\uff0c\u4f86\u8a8d\u8b58pySerial\u6a21\u7d44\u7684\u7528\u6cd5\u3002<\/p>\n<p>\u5e95\u4e0b\u662f\u6bcf\u9694\u4e00\u79d2\u50b3\u9001\u201chello!\u201d\u8a0a\u606f\u7684Arduino\u7a0b\u5f0f\uff1a<\/p>\n<pre>unsigned long previousMillis = 0;\nconst long interval = 1000;    \/\/ \u8a2d\u5b9a\u9593\u9694\u6642\u9593\uff0c1000ms\nchar chr;\n\nvoid setup() {\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  unsigned long currentMillis = millis();\n\n  if (currentMillis - previousMillis &gt;= interval) {\n    previousMillis = currentMillis;\n    Serial.println(\"hello!\");\n  }\n}\n\n<\/pre>\n<p>\u5e95\u4e0b\u662f\u63a1\u7528pySerial\u6a21\u7d44\u63a5\u6536\u5e8f\u5217\u8cc7\u6599\u7684Python\u7a0b\u5f0f\u78bc\uff0c<strong>\u5b83\u5c07\u4e0d\u505c\u5730\u63a5\u6536\u8207\u986f\u793a\u6536\u5230\u7684\u5e8f\u5217\u8cc7\u6599\uff0c\u76f4\u5230\u4f60\u6309\u4e0bCtrl\u548cC\u9375\u70ba\u6b62\u3002<\/strong>\u7b46\u8005\u5047\u8a2dArduino\u6240\u5728\u7684\u5e8f\u5217\u57e0\u540d\u7a31\u662fCOM6\uff0c\u8acb\u81ea\u884c\u4fee\u6539\u3002<strong>macOS\u7cfb\u7d71\u7684\u901a\u8a0a\u57e0\u540d\u7a31\u985e\u4f3c\u9019\u6a23\uff1a\/dev\/tty.usbmodem231<\/strong>\u3002<\/p>\n<pre>import serial  # \u5f15\u7528pySerial\u6a21\u7d44\n\nCOM_PORT = 'COM6'    # \u6307\u5b9a\u901a\u8a0a\u57e0\u540d\u7a31\nBAUD_RATES = 9600    # \u8a2d\u5b9a\u50b3\u8f38\u901f\u7387\nser = serial.Serial(COM_PORT, BAUD_RATES)   # \u521d\u59cb\u5316\u5e8f\u5217\u901a\u8a0a\u57e0\n\ntry:\n    while True:\n        while ser.in_waiting:          # \u82e5\u6536\u5230\u5e8f\u5217\u8cc7\u6599\u2026\n            data_raw = ser.readline()  # \u8b80\u53d6\u4e00\u884c\n            data = data_raw.decode()   # \u7528\u9810\u8a2d\u7684UTF-8\u89e3\u78bc\n            print('\u63a5\u6536\u5230\u7684\u539f\u59cb\u8cc7\u6599\uff1a', data_raw)\n            print('\u63a5\u6536\u5230\u7684\u8cc7\u6599\uff1a', data)\n\nexcept KeyboardInterrupt:\n    ser.close()    # \u6e05\u9664\u5e8f\u5217\u901a\u8a0a\u7269\u4ef6\n    print('\u518d\u898b\uff01')\n<\/pre>\n<p>\u9023\u63a5Arduino\uff0c\u518d\u57f7\u884c\u4e0a\u9762\u7684Python\u7a0b\u5f0f\uff0c\u5c07\u80fd\u6536\u5230\u4f86\u81eaArduino\u7684\u8a0a\u606f\u3002<strong>\u539f\u59cb\u8cc7\u6599\u662fbyte\u683c\u5f0f<\/strong>\uff1a<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/books\/micropython\/python_serial_arduino.png\" width=\"783\" height=\"324\" alt=\"\u7d42\u7aef\u6a5f\u63a5\u6536Arduino\u5e8f\u5217\u8a0a\u606f\"\/><\/p>\n<h2>\u4f7f\u7528Python\u5e8f\u5217\u7a0b\u5f0f\u63a7\u5236Arduino\u6216MicroPython\u677f\u7684LED<\/h2>\n<p>\u672c\u55ae\u5143\u7684Python\u7a0b\u5f0f\u5c07\u5728\u7d42\u7aef\u6a5f\u986f\u793a\uff1a\u300c\u63091\u958b\u71c8\u3001\u63092\u95dc\u71c8\u3001\u6309e\u95dc\u9589\u7a0b\u5f0f\u300d\uff1b\u82e5\u7528\u6236\u6309\u4e0b1\uff0cPython\u5c07\u900f\u904e\u5e8f\u5217\u57e0\u50b3\u905e\u4ee3\u8868\u958b\u71c8\u7684<strong>b&#8217;LED_ON\\n&#8217;<\/strong>\u8a0a\u606f\uff1b\u82e5\u6309\u4e0b2\uff0c\u5247\u9001\u51fa\u4ee3\u8868\u958b\u71c8\u7684<strong>b&#8217;LED_OFF\\n&#8217;<\/strong>\u8a0a\u606f\uff0c\u9019\u5169\u500b\u8a0a\u606f\u90fd\u662f\u7b46\u8005\u81ea\u8a02\u7684\uff0c<strong>\u8a0a\u606f\u5167\u5bb9\u5fc5\u9808\u662fbyte\u683c\u5f0f\u3002<\/strong><\/p>\n<p>\u96fb\u8166\u7aef\u7684Python\u5e8f\u5217\u901a\u8a0a\u7a0b\u5f0f\u78bc\u5982\u4e0b\uff1a<\/p>\n<pre>import serial\nfrom time import sleep\nimport sys\n\nCOM_PORT = 'COM8'  # \u8acb\u81ea\u884c\u4fee\u6539\u5e8f\u5217\u57e0\u540d\u7a31\nBAUD_RATES = 9600\nser = serial.Serial(COM_PORT, BAUD_RATES)\n\ntry:\n    while True:\n        # \u63a5\u6536\u7528\u6236\u7684\u8f38\u5165\u503c\u4e26\u8f49\u6210\u5c0f\u5beb\n        choice = input('\u63091\u958b\u71c8\u3001\u63092\u95dc\u71c8\u3001\u6309e\u95dc\u9589\u7a0b\u5f0f  ').lower()\n\n        if choice == '1':\n            print('\u50b3\u9001\u958b\u71c8\u6307\u4ee4')\n            ser.write(b'LED_ON\\n')  # \u8a0a\u606f\u5fc5\u9808\u662f\u4f4d\u5143\u7d44\u985e\u578b\n            sleep(0.5)              # \u66ab\u505c0.5\u79d2\uff0c\u518d\u57f7\u884c\u5e95\u4e0b\u63a5\u6536\u56de\u61c9\u8a0a\u606f\u7684\u8ff4\u5708\n        elif choice == '2':\n            print('\u50b3\u9001\u95dc\u71c8\u6307\u4ee4')\n            ser.write(b'LED_OFF\\n')\n            sleep(0.5)\n        elif choice == 'e':\n            ser.close()\n            print('\u518d\u898b\uff01')\n            sys.exit()\n        else:\n            print('\u6307\u4ee4\u932f\u8aa4\u2026')\n\n        while ser.in_waiting:\n            mcu_feedback = ser.readline().decode()  # \u63a5\u6536\u56de\u61c9\u8a0a\u606f\u4e26\u89e3\u78bc\n            print('\u63a7\u5236\u677f\u56de\u61c9\uff1a', mcu_feedback)\n            \nexcept KeyboardInterrupt:\n    ser.close()\n    print('\u518d\u898b\uff01')\n\n<\/pre>\n<h2>\u4f7f\u7528Arduino Uno\u9032\u884c\u5e8f\u5217\u901a\u8a0a<\/h2>\n<p>\u63a5\u6536\u4f86\u81ea\u96fb\u8166Python\u7684\u5e8f\u5217\u8a0a\u606f\uff0c\u958b\u3001\u95dc\u7b2c13\u8173\u7684LED\u7684Arduino\u7a0b\u5f0f\u78bc\u5982\u4e0b\uff1a<\/p>\n<pre>#define LED 13\nString str;\n\nvoid setup() {\n  pinMode(LED, OUTPUT);\n  Serial.begin(9600);\n}\n\nvoid loop() {\n  if (Serial.available()) {\n    \/\/ \u8b80\u53d6\u50b3\u5165\u7684\u5b57\u4e32\u76f4\u5230\"\\n\"\u7d50\u5c3e\n    str = Serial.readStringUntil('\\n');\n\n    if (str == \"LED_ON\") {           \/\/ \u82e5\u5b57\u4e32\u503c\u662f \"LED_ON\" \u958b\u71c8\n        digitalWrite(LED, HIGH);     \/\/ \u958b\u71c8\n        Serial.println(\"LED is ON\"); \/\/ \u56de\u61c9\u8a0a\u606f\u7d66\u96fb\u8166\n    } else if (str == \"LED_OFF\") {\n        digitalWrite(LED, LOW);\n        Serial.println(\"LED is OFF\");\n    }\n  }\n}\n\n<\/pre>\n<h2>\u4f7f\u7528MicroPython\uff08Wemos D1 mini\u677f\uff09\u9032\u884c\u5e8f\u5217\u901a\u8a0a<\/h2>\n<p>\u5e95\u4e0b\u662f\u5728ESP8266\u63a7\u5236\u677f\uff08D1 mini\uff09\u57f7\u884cmicroPython\uff0c\u63a5\u6536\u5e8f\u5217\u8a0a\u606f\u7684\u7a0b\u5f0f\uff1a<\/p>\n<pre>from machine import Pin\nfrom machine import UART\n\ncom = UART(0, 9600)\ncom.init(9600)\n\nled = Pin(2, Pin.OUT, value=1)\n\nprint('MicroPython Ready...')\n\nwhile True:\n    choice = com.readline()\n    \n    if choice == b'LED_ON\\n':\n        led.value(0)\n        com.write(b'LED is ON!\\n')  # \u56de\u61c9\u8a0a\u606f\u7d66\u96fb\u8166\u7aef\u7684Python\n    elif choice == b'LED_OFF\\n':\n        led.value(1)\n        com.write(b'LED is OFF!\\n')\n\n<\/pre>\n<p>\u7b46\u8005\u5c07\u6b64\u7a0b\u5f0f\u547d\u540d\u6210ser_test.py\u6a94\uff0c\u518d\u4f7f\u7528ampy\u5de5\u5177\u4e0a\u50b3\u5230D1 mini\u677f\u3002<strong>\u4e0a\u50b3\u5b8c\u7562\u5f8c\uff0c\u8acb\u5148\u6309\u4e00\u4e0bD1 mini\u677f\u7684Reset\uff08\u91cd\u7f6e\uff09\u9375\u3002<\/strong><\/p>\n<p>\u63a5\u8457\u4f7f\u7528WebREPL\u9023\u7dda\u5230D1 mini\u677f\uff0c\u900f\u904eimport ser_test\u57f7\u884c\u5e8f\u5217\u901a\u8a0a\u6e2c\u8a66\u7a0b\u5f0f\uff0c\u76f8\u95dc\u64cd\u4f5c\u8aaa\u660e\u8acb\u53c3\u95b1\u300a<a href=\"\/?p=1129\" target=\"_blank\">\u8d85\u5716\u89e3 Python \u7269\u806f\u7db2\u5be6\u4f5c\u5165\u9580<\/a>\u300b\u7b2c\u4e03\u7ae0\u300c\u5e8f\u5217\u57e0\u901a\u4fe1\u300d7-21\u9801\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/books\/micropython\/microPython_serial.png\" width=\"636\" height=\"267\" alt=\"WebREPL\u4ecb\u9762\"\/><\/p>\n<p>\u57f7\u884c\u6b64Python\u5e8f\u5217\u901a\u8a0a\u7a0b\u5f0f\u7684\u64cd\u4f5c\u756b\u9762\u5982\u4e0b\uff1a<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/books\/micropython\/python_serial_terminal.png\" width=\"778\" height=\"355\" alt=\"Python\u5e8f\u5217\u901a\u8a0a\u7a0b\u5f0f\u7684\u64cd\u4f5c\u756b\u9762\"\/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528Wi-Fi\u9023\u7dda\u986f\u7136\u6bd4\u8f03\u7b26\u5408ESP8266\u7684\u5929\u6027\uff0c\u4f46\u662f\u5c0d\u65bc\u6c92\u6709\u5167\u5efaWi-Fi\u7684MicroPython\u63a7\u5236\u677f\u6216\u8005Arduino\u677f\uff0cUSB\u662f\u6700\u666e\u904d\u7684\u9078\u64c7\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u4f7f\u7528Python\u7a0b\u5f0f\u8207Arduino\u548cMicroPython\uff08ESP8266\u677f\uff09\u9032\u884c\u5e8f\u5217\u901a\u8a0a\u7684\u65b9\u6cd5\u3002<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"\/images\/books\/micropython\/esp8266_serial.png\" width=\"517\" height=\"172\" alt=\"USB\u5e8f\u5217\u9023\u63a5ESP8266\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[15],"tags":[32,44,49],"class_list":["post-1188","post","type-post","status-publish","format-standard","hentry","category-diy","tag-arduino","tag-esp8266","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8<\/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:\/\/swf.com.tw\/?p=1188\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005:\" \/>\n\t<meta name=\"twitter:data1\" content=\"cubie\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=1188#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=1188\"},\"author\":{\"name\":\"cubie\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/person\\\/24480fda9184aa137df8f05d79bc2f57\"},\"headline\":\"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython\",\"datePublished\":\"2018-12-25T11:50:43+00:00\",\"dateModified\":\"2018-12-25T11:50:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=1188\"},\"wordCount\":94,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#organization\"},\"keywords\":[\"arduino\",\"ESP8266\",\"Python\"],\"articleSection\":[\"\u786c\u9ad4\u8207DIY\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/swf.com.tw\\\/?p=1188#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=1188\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/?p=1188\",\"name\":\"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#website\"},\"datePublished\":\"2018-12-25T11:50:43+00:00\",\"dateModified\":\"2018-12-25T11:50:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=1188#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swf.com.tw\\\/?p=1188\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=1188#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swf.com.tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#website\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/\",\"name\":\"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\",\"description\":\"Arduino+Python+JavaScript+\u7a0b\u5f0f\u8a2d\u8a08+\u786c\u9ad4DIY\",\"publisher\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swf.com.tw\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#organization\",\"name\":\"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/logo_bat.png\",\"contentUrl\":\"https:\\\/\\\/swf.com.tw\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/logo_bat.png\",\"width\":71,\"height\":65,\"caption\":\"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\"},\"image\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/person\\\/24480fda9184aa137df8f05d79bc2f57\",\"name\":\"cubie\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g\",\"caption\":\"cubie\"},\"sameAs\":[\"https:\\\/\\\/swf.com.tw\"],\"url\":\"https:\\\/\\\/swf.com.tw\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","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:\/\/swf.com.tw\/?p=1188","twitter_misc":{"\u4f5c\u8005:":"cubie","\u9810\u4f30\u95b1\u8b80\u6642\u9593":"2 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swf.com.tw\/?p=1188#article","isPartOf":{"@id":"https:\/\/swf.com.tw\/?p=1188"},"author":{"name":"cubie","@id":"https:\/\/swf.com.tw\/#\/schema\/person\/24480fda9184aa137df8f05d79bc2f57"},"headline":"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython","datePublished":"2018-12-25T11:50:43+00:00","dateModified":"2018-12-25T11:50:46+00:00","mainEntityOfPage":{"@id":"https:\/\/swf.com.tw\/?p=1188"},"wordCount":94,"commentCount":7,"publisher":{"@id":"https:\/\/swf.com.tw\/#organization"},"keywords":["arduino","ESP8266","Python"],"articleSection":["\u786c\u9ad4\u8207DIY"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/swf.com.tw\/?p=1188#respond"]}]},{"@type":"WebPage","@id":"https:\/\/swf.com.tw\/?p=1188","url":"https:\/\/swf.com.tw\/?p=1188","name":"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","isPartOf":{"@id":"https:\/\/swf.com.tw\/#website"},"datePublished":"2018-12-25T11:50:43+00:00","dateModified":"2018-12-25T11:50:46+00:00","breadcrumb":{"@id":"https:\/\/swf.com.tw\/?p=1188#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swf.com.tw\/?p=1188"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/swf.com.tw\/?p=1188#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swf.com.tw\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528Python\u7684pySerial\u6a21\u7d44\u9032\u884c\u5e8f\u5217\u901a\u8a0a\uff1a\u9023\u63a5\u96fb\u8166\u8207Arduino\u548cMicroPython"}]},{"@type":"WebSite","@id":"https:\/\/swf.com.tw\/#website","url":"https:\/\/swf.com.tw\/","name":"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","description":"Arduino+Python+JavaScript+\u7a0b\u5f0f\u8a2d\u8a08+\u786c\u9ad4DIY","publisher":{"@id":"https:\/\/swf.com.tw\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swf.com.tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Organization","@id":"https:\/\/swf.com.tw\/#organization","name":"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","url":"https:\/\/swf.com.tw\/","logo":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/swf.com.tw\/#\/schema\/logo\/image\/","url":"https:\/\/swf.com.tw\/wp-content\/uploads\/2019\/10\/logo_bat.png","contentUrl":"https:\/\/swf.com.tw\/wp-content\/uploads\/2019\/10\/logo_bat.png","width":71,"height":65,"caption":"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8"},"image":{"@id":"https:\/\/swf.com.tw\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/swf.com.tw\/#\/schema\/person\/24480fda9184aa137df8f05d79bc2f57","name":"cubie","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/secure.gravatar.com\/avatar\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g","caption":"cubie"},"sameAs":["https:\/\/swf.com.tw"],"url":"https:\/\/swf.com.tw\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/1188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1188"}],"version-history":[{"count":0,"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/1188\/revisions"}],"wp:attachment":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}