{"id":969767,"date":"2024-12-27T05:19:55","date_gmt":"2024-12-26T21:19:55","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/969767.html"},"modified":"2024-12-27T05:19:57","modified_gmt":"2024-12-26T21:19:57","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e6%8e%a7%e5%88%b6%e6%9c%ba%e5%99%a8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/969767.html","title":{"rendered":"\u5982\u4f55\u7528python\u63a7\u5236\u673a\u5668"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24183901\/5086b2e8-0d51-42d9-a5a7-877e6f0d88e7.webp\" alt=\"\u5982\u4f55\u7528python\u63a7\u5236\u673a\u5668\" \/><\/p>\n<p><p> <strong>\u7528Python\u63a7\u5236\u673a\u5668\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u5e93\u5982PySerial\u4e0e\u673a\u5668\u8fdb\u884c\u4e32\u884c\u901a\u4fe1\u3001\u5229\u7528GPIO\u5e93\u63a7\u5236\u6811\u8393\u6d3e\u7b49\u786c\u4ef6\u3001\u901a\u8fc7\u7f51\u7edc\u534f\u8bae\u4e0e\u8fdc\u7a0b\u8bbe\u5907\u4ea4\u4e92\u3001\u501f\u52a9<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u5e93\u8fdb\u884c\u667a\u80fd\u63a7\u5236\u3002<\/strong> \u4f7f\u7528PySerial\u5e93\u53ef\u4ee5\u5b9e\u73b0\u4e0e\u673a\u5668\u4e4b\u95f4\u7684\u4e32\u884c\u901a\u4fe1\uff0c\u8fd9\u5728\u5de5\u4e1a\u81ea\u52a8\u5316\u548c\u673a\u5668\u4eba\u63a7\u5236\u4e2d\u975e\u5e38\u5e38\u89c1\u3002\u901a\u8fc7Python\u7f16\u7a0b\uff0c\u53ef\u4ee5\u53d1\u9001\u548c\u63a5\u6536\u6570\u636e\uff0c\u4ece\u800c\u5b9e\u73b0\u5bf9\u673a\u5668\u7684\u5b9e\u65f6\u63a7\u5236\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7PySerial\u5e93\u63a7\u5236\u673a\u5668\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528PYSERIAL\u5e93\u8fdb\u884c\u4e32\u884c\u901a\u4fe1<\/h3>\n<\/p>\n<p><p>PySerial\u662f\u4e00\u4e2aPython\u5e93\uff0c\u7528\u4e8e\u8bbf\u95ee\u4e32\u884c\u7aef\u53e3\u3002\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u4e0e\u8fde\u63a5\u5230\u8ba1\u7b97\u673a\u7684\u4e32\u884c\u8bbe\u5907\u8fdb\u884c\u901a\u4fe1\uff0c\u5982Arduino\u3001\u5355\u7247\u673a\u7b49\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u4e0e\u57fa\u7840\u4f7f\u7528<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u9700\u8981\u5b89\u88c5PySerial\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pyserial<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u6253\u5f00\u4e32\u884c\u7aef\u53e3\u5e76\u53d1\u9001\u6570\u636e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import serial<\/p>\n<h2><strong>\u6253\u5f00\u4e32\u884c\u7aef\u53e3<\/strong><\/h2>\n<p>ser = serial.Serial(&#39;\/dev\/ttyUSB0&#39;, 9600)<\/p>\n<h2><strong>\u53d1\u9001\u6570\u636e<\/strong><\/h2>\n<p>ser.write(b&#39;Hello, Machine!&#39;)<\/p>\n<h2><strong>\u5173\u95ed\u4e32\u53e3<\/strong><\/h2>\n<p>ser.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u6253\u5f00\u4e86\u4e00\u4e2a\u4e32\u884c\u7aef\u53e3\uff0c\u7136\u540e\u901a\u8fc7<code>write<\/code>\u65b9\u6cd5\u53d1\u9001\u6570\u636e\uff0c\u6700\u540e\u5173\u95ed\u4e32\u53e3\u3002<\/p>\n<\/p>\n<p><h4>2. \u8bfb\u53d6\u4e32\u884c\u6570\u636e<\/h4>\n<\/p>\n<p><p>\u9664\u4e86\u53d1\u9001\u6570\u636e\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4ece\u4e32\u884c\u7aef\u53e3\u8bfb\u53d6\u6570\u636e\u3002\u8fd9\u5728\u9700\u8981\u4ece\u673a\u5668\u83b7\u53d6\u72b6\u6001\u4fe1\u606f\u6216\u4f20\u611f\u5668\u6570\u636e\u65f6\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import serial<\/p>\n<h2><strong>\u6253\u5f00\u4e32\u884c\u7aef\u53e3<\/strong><\/h2>\n<p>ser = serial.Serial(&#39;\/dev\/ttyUSB0&#39;, 9600)<\/p>\n<h2><strong>\u8bfb\u53d6\u6570\u636e<\/strong><\/h2>\n<p>data = ser.readline()<\/p>\n<p>print(data.decode(&#39;utf-8&#39;))<\/p>\n<h2><strong>\u5173\u95ed\u4e32\u53e3<\/strong><\/h2>\n<p>ser.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7<code>readline<\/code>\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u8bfb\u53d6\u4e00\u884c\u6570\u636e\uff0c\u5e76\u901a\u8fc7<code>decode<\/code>\u65b9\u6cd5\u5c06\u5176\u89e3\u7801\u4e3a\u5b57\u7b26\u4e32\u683c\u5f0f\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5229\u7528GPIO\u5e93\u63a7\u5236\u6811\u8393\u6d3e\u786c\u4ef6<\/h3>\n<\/p>\n<p><p>\u6811\u8393\u6d3e\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5355\u677f\u8ba1\u7b97\u673a\uff0c\u5e38\u7528\u4e8e\u7535\u5b50\u9879\u76ee\u548c\u7269\u8054\u7f51\u5e94\u7528\u3002\u901a\u8fc7Python\u7684GPIO\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u63a7\u5236\u6811\u8393\u6d3e\u7684\u5f15\u811a\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u4e0e\u914d\u7f6e<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u5728\u6811\u8393\u6d3e\u4e0a\u5b89\u88c5\u4e86Raspberry Pi GPIO\u5e93\u3002\u901a\u5e38\uff0c\u5b83\u4f1a\u9ed8\u8ba4\u5b89\u88c5\u5728Raspbian\u7cfb\u7edf\u4e0a\u3002\u5982\u679c\u6ca1\u6709\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get update<\/p>\n<p>sudo apt-get install python3-rpi.gpio<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u63a7\u5236GPIO\u5f15\u811a<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u6f14\u793a\u5982\u4f55\u4f7f\u7528Python\u63a7\u5236\u6811\u8393\u6d3e\u4e0a\u7684\u4e00\u4e2aLED\u706f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import RPi.GPIO as GPIO<\/p>\n<p>import time<\/p>\n<h2><strong>\u8bbe\u7f6eGPIO\u6a21\u5f0f<\/strong><\/h2>\n<p>GPIO.setmode(GPIO.BCM)<\/p>\n<h2><strong>\u8bbe\u7f6eGPIO\u5f15\u811a<\/strong><\/h2>\n<p>GPIO.setup(18, GPIO.OUT)<\/p>\n<h2><strong>\u63a7\u5236LED\u706f\u95ea\u70c1<\/strong><\/h2>\n<p>try:<\/p>\n<p>    while True:<\/p>\n<p>        GPIO.output(18, GPIO.HIGH)  # \u6253\u5f00LED<\/p>\n<p>        time.sleep(1)              # \u7b49\u5f851\u79d2<\/p>\n<p>        GPIO.output(18, GPIO.LOW)  # \u5173\u95edLED<\/p>\n<p>        time.sleep(1)<\/p>\n<p>except KeyboardInterrupt:<\/p>\n<p>    pass<\/p>\n<h2><strong>\u6e05\u7406GPIO\u8bbe\u7f6e<\/strong><\/h2>\n<p>GPIO.cleanup()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u8bbe\u7f6e\u4e86GPIO\u6a21\u5f0f\uff0c\u5e76\u6307\u5b9a\u4e86\u4e00\u4e2a\u8f93\u51fa\u5f15\u811a\u3002\u901a\u8fc7<code>output<\/code>\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u63a7\u5236\u5f15\u811a\u7684\u9ad8\u4f4e\u7535\u5e73\uff0c\u4ece\u800c\u63a7\u5236\u8fde\u63a5\u5728\u8be5\u5f15\u811a\u4e0a\u7684\u8bbe\u5907\uff08\u4f8b\u5982LED\u706f\uff09\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u901a\u8fc7\u7f51\u7edc\u534f\u8bae\u4e0e\u8fdc\u7a0b\u8bbe\u5907\u4ea4\u4e92<\/h3>\n<\/p>\n<p><p>Python\u8fd8\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u534f\u8bae\uff08\u5982HTTP\u3001MQTT\u3001WebSocket\u7b49\uff09\u4e0e\u8fdc\u7a0b\u8bbe\u5907\u8fdb\u884c\u4ea4\u4e92\uff0c\u8fd9\u5bf9\u4e8e\u7269\u8054\u7f51\u5e94\u7528\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h4>1. \u4f7f\u7528HTTP\u534f\u8bae<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>requests<\/code>\u5e93\u53d1\u9001HTTP\u8bf7\u6c42\uff0c\u4e0e\u652f\u6301REST API\u7684\u8bbe\u5907\u901a\u4fe1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<h2><strong>\u53d1\u9001GET\u8bf7\u6c42<\/strong><\/h2>\n<p>response = requests.get(&#39;http:\/\/example.com\/api\/device\/status&#39;)<\/p>\n<p>print(response.json())<\/p>\n<h2><strong>\u53d1\u9001POST\u8bf7\u6c42<\/strong><\/h2>\n<p>data = {&#39;command&#39;: &#39;turn_on&#39;}<\/p>\n<p>response = requests.post(&#39;http:\/\/example.com\/api\/device\/control&#39;, json=data)<\/p>\n<p>print(response.json())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528MQTT\u534f\u8bae<\/h4>\n<\/p>\n<p><p>MQTT\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u534f\u8bae\uff0c\u5e38\u7528\u4e8e\u7269\u8054\u7f51\u8bbe\u5907\u4e4b\u95f4\u7684\u901a\u4fe1\u3002\u53ef\u4ee5\u4f7f\u7528<code>paho-mqtt<\/code>\u5e93\u5b9e\u73b0MQTT\u901a\u4fe1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import paho.mqtt.client as mqtt<\/p>\n<h2><strong>\u5b9a\u4e49\u56de\u8c03\u51fd\u6570<\/strong><\/h2>\n<p>def on_connect(client, userdata, flags, rc):<\/p>\n<p>    print(&quot;Connected with result code &quot; + str(rc))<\/p>\n<p>    client.subscribe(&quot;device\/status&quot;)<\/p>\n<p>def on_message(client, userdata, msg):<\/p>\n<p>    print(msg.topic + &quot; &quot; + str(msg.payload))<\/p>\n<h2><strong>\u521b\u5efaMQTT\u5ba2\u6237\u7aef<\/strong><\/h2>\n<p>client = mqtt.Client()<\/p>\n<p>client.on_connect = on_connect<\/p>\n<p>client.on_message = on_message<\/p>\n<h2><strong>\u8fde\u63a5\u5230MQTT\u4ee3\u7406<\/strong><\/h2>\n<p>client.connect(&quot;mqtt.example.com&quot;, 1883, 60)<\/p>\n<h2><strong>\u53d1\u9001\u6d88\u606f<\/strong><\/h2>\n<p>client.publish(&quot;device\/control&quot;, &quot;turn_on&quot;)<\/p>\n<h2><strong>\u5f00\u59cb\u5faa\u73af<\/strong><\/h2>\n<p>client.loop_forever()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u501f\u52a9\u673a\u5668\u5b66\u4e60\u5e93\u8fdb\u884c\u667a\u80fd\u63a7\u5236<\/h3>\n<\/p>\n<p><p>\u5229\u7528Python\u7684\u673a\u5668\u5b66\u4e60\u5e93\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u673a\u5668\u7684\u667a\u80fd\u63a7\u5236\u3002\u8fd9\u5bf9\u4e8e\u81ea\u4e3b\u673a\u5668\u4eba\u6216\u667a\u80fd\u5bb6\u5c45\u7cfb\u7edf\u7b49\u5e94\u7528\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h4>1. \u4f7f\u7528Scikit-learn\u8fdb\u884c\u63a7\u5236<\/h4>\n<\/p>\n<p><p>Scikit-learn\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u673a\u5668\u5b66\u4e60\u5e93\uff0c\u53ef\u4ee5\u7528\u4e8e\u8bad\u7ec3\u6a21\u578b\u5e76\u8fdb\u884c\u9884\u6d4b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.linear_model import LinearRegression<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u8bad\u7ec3\u6570\u636e<\/strong><\/h2>\n<p>X = np.array([[1], [2], [3], [4], [5]])<\/p>\n<p>y = np.array([2, 4, 6, 8, 10])<\/p>\n<h2><strong>\u521b\u5efa\u5e76\u8bad\u7ec3\u6a21\u578b<\/strong><\/h2>\n<p>model = LinearRegression()<\/p>\n<p>model.fit(X, y)<\/p>\n<h2><strong>\u9884\u6d4b<\/strong><\/h2>\n<p>prediction = model.predict(np.array([[6]]))<\/p>\n<p>print(&quot;Prediction for input 6:&quot;, prediction)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528TensorFlow\u8fdb\u884c\u6df1\u5ea6\u5b66\u4e60\u63a7\u5236<\/h4>\n<\/p>\n<p><p>TensorFlow\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\uff0c\u53ef\u4ee5\u7528\u4e8e\u6784\u5efa\u590d\u6742\u7684\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tensorflow as tf<\/p>\n<h2><strong>\u6784\u5efa\u7b80\u5355\u7684\u795e\u7ecf\u7f51\u7edc<\/strong><\/h2>\n<p>model = tf.keras.models.Sequential([<\/p>\n<p>    tf.keras.layers.Dense(128, activation=&#39;relu&#39;, input_shape=(10,)),<\/p>\n<p>    tf.keras.layers.Dense(64, activation=&#39;relu&#39;),<\/p>\n<p>    tf.keras.layers.Dense(1)<\/p>\n<p>])<\/p>\n<h2><strong>\u7f16\u8bd1\u6a21\u578b<\/strong><\/h2>\n<p>model.compile(optimizer=&#39;adam&#39;, loss=&#39;mean_squared_error&#39;)<\/p>\n<h2><strong>\u5047\u8bbe\u6709\u4e00\u4e9b\u8bad\u7ec3\u6570\u636e<\/strong><\/h2>\n<p>import numpy as np<\/p>\n<p>X_tr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n = np.random.rand(100, 10)<\/p>\n<p>y_train = np.random.rand(100, 1)<\/p>\n<h2><strong>\u8bad\u7ec3\u6a21\u578b<\/strong><\/h2>\n<p>model.fit(X_train, y_train, epochs=10)<\/p>\n<h2><strong>\u9884\u6d4b<\/strong><\/h2>\n<p>X_new = np.random.rand(1, 10)<\/p>\n<p>prediction = model.predict(X_new)<\/p>\n<p>print(&quot;Prediction for new input:&quot;, prediction)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0cPython\u53ef\u4ee5\u7528\u4e8e\u591a\u79cd\u673a\u5668\u63a7\u5236\u4efb\u52a1\uff0c\u4ece\u7b80\u5355\u7684\u4e32\u884c\u901a\u4fe1\u5230\u590d\u6742\u7684\u667a\u80fd\u63a7\u5236\uff0c\u5c55\u793a\u4e86\u5176\u5728\u81ea\u52a8\u5316\u548c\u7269\u8054\u7f51\u9886\u57df\u7684\u5f3a\u5927\u5e94\u7528\u6f5c\u529b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u4e0e\u786c\u4ef6\u8fdb\u884c\u4ea4\u4e92\uff1f<\/strong><br \/>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u5e93\u548c\u5de5\u5177\uff0c\u4f7f\u5f97\u4e0e\u786c\u4ef6\u7684\u4ea4\u4e92\u53d8\u5f97\u7b80\u5355\u3002\u5e38\u7528\u7684\u5e93\u5305\u62ecRaspberry Pi\u7684RPi.GPIO\u3001Arduino\u7684pyFirmata\u548cpySerial\u7b49\u3002\u901a\u8fc7\u8fd9\u4e9b\u5e93\uff0c\u4f60\u53ef\u4ee5\u63a7\u5236GPIO\u5f15\u811a\u3001\u4e0e\u4f20\u611f\u5668\u8fdb\u884c\u901a\u4fe1\u4ee5\u53ca\u8bfb\u53d6\u6570\u636e\uff0c\u4ece\u800c\u5b9e\u73b0\u5bf9\u673a\u5668\u7684\u63a7\u5236\u3002<\/p>\n<p><strong>Python\u63a7\u5236\u673a\u5668\u7684\u5e94\u7528\u573a\u666f\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>Python\u5728\u673a\u5668\u63a7\u5236\u65b9\u9762\u7684\u5e94\u7528\u975e\u5e38\u5e7f\u6cdb\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u7528\u4e8e\u81ea\u52a8\u5316\u4efb\u52a1\uff0c\u5982\u5bb6\u5ead\u81ea\u52a8\u5316\uff08\u63a7\u5236\u706f\u5149\u3001\u6e29\u5ea6\u7b49\uff09\uff0c\u5de5\u4e1a\u81ea\u52a8\u5316\uff08\u76d1\u63a7\u548c\u63a7\u5236\u751f\u4ea7\u7ebf\uff09\uff0c\u4ee5\u53ca\u673a\u5668\u4eba\u63a7\u5236\uff08\u79fb\u52a8\u548c\u5bfc\u822a\uff09\u3002\u6b64\u5916\uff0cPython\u4e5f\u5e38\u7528\u4e8e\u6570\u636e\u91c7\u96c6\u548c\u5904\u7406\uff0c\u4e3a\u673a\u5668\u51b3\u7b56\u63d0\u4f9b\u652f\u6301\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u63a7\u5236\u673a\u5668\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u5b89\u5168\u95ee\u9898\uff1f<\/strong><br \/>\u5728\u4f7f\u7528Python\u63a7\u5236\u673a\u5668\u65f6\uff0c\u5b89\u5168\u6027\u662f\u4e00\u4e2a\u91cd\u8981\u8003\u8651\u56e0\u7d20\u3002\u786e\u4fdd\u6240\u6709\u8fde\u63a5\u90fd\u7ecf\u8fc7\u9002\u5f53\u7684\u7edd\u7f18\u548c\u4fdd\u62a4\uff0c\u4ee5\u9632\u6b62\u77ed\u8def\u548c\u7535\u51fb\u3002\u5728\u7f16\u5199\u63a7\u5236\u7a0b\u5e8f\u65f6\uff0c\u9700\u8003\u8651\u5230\u5f02\u5e38\u60c5\u51b5\u5e76\u8bbe\u7f6e\u5fc5\u8981\u7684\u4fdd\u62a4\u63aa\u65bd\uff0c\u5982\u7d27\u6025\u505c\u6b62\u529f\u80fd\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u9075\u5faa\u76f8\u5173\u7684\u7535\u6c14\u548c\u673a\u68b0\u5b89\u5168\u89c4\u8303\uff0c\u4ee5\u907f\u514d\u610f\u5916\u4e8b\u6545\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u7528Python\u63a7\u5236\u673a\u5668\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u5e93\u5982PySerial\u4e0e\u673a\u5668\u8fdb\u884c\u4e32\u884c\u901a\u4fe1\u3001\u5229\u7528GPIO\u5e93\u63a7\u5236\u6811\u8393\u6d3e\u7b49\u786c\u4ef6\u3001 [&hellip;]","protected":false},"author":3,"featured_media":969768,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/969767"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=969767"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/969767\/revisions"}],"predecessor-version":[{"id":969769,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/969767\/revisions\/969769"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/969768"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=969767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=969767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=969767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}