{"id":12507,"date":"2021-09-09T10:25:00","date_gmt":"2021-09-09T02:25:00","guid":{"rendered":"http:\/\/222.73.203.234:9999\/?p=12507"},"modified":"2022-03-28T15:15:08","modified_gmt":"2022-03-28T07:15:08","slug":"%e9%80%9a%e8%bf%87rpi-gpio-python%e5%ba%93%e4%bd%bf%e7%94%a8raspberry-pi-gpio%e5%bc%95%e8%84%9a-2","status":"publish","type":"post","link":"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/how-tos\/raspberry\/using-raspberry-pi-gpio-pins-with-the-rpi-gpio-python-library","title":{"rendered":"\u901a\u8fc7RPi.GPIO Python\u5e93\u4f7f\u7528Raspberry Pi GPIO\u5f15\u811a"},"content":{"rendered":"<div class=\"the_content_wrapper\">\n\u8fd9\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e<a href=\"https:\/\/www.deviceplus.com\/\">DevicePlus.com<\/a>\u82f1\u8bed\u7f51\u7ad9\u7684\u7ffb\u8bd1\u7a3f\u3002\u57282016\u5e74\u63a8\u51faGPIO Zero\u4e4b\u524d\uff0c\u65b0\u7528\u6237\u901a\u5e38\u4f7f\u7528\u53e6\u4e00\u4e2aPython\u6a21\u5757\uff08RPi.GPIO\uff09\u6765\u4f7f\u7528<a href=\"https:\/\/www.deviceplus.com\/raspberry-pi\/an-introduction-to-raspberry-pi-gpio-pins\/\">GPIO\u5f15\u811a<\/a>\u3002<br \/>\n\u4f7f\u7528RPi.GPIO\u9700\u8981\u5b66\u4e60\u66f4\u591a\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4f46\u662f\u4e8b\u5b9e\u8bc1\u660e\u82b1\u8d39\u8fd9\u4e9b\u7cbe\u529b\u662f\u503c\u5f97\u7684\u3002<\/p>\n<h3>\u4e3a\u4ec0\u4e48\u4e0d\u76f4\u63a5\u4f7f\u7528GPIO Zero\uff1f<\/h3>\n<p>GPIO Zero\u5e76\u4e0d\u662f\u4f5c\u4e3aRPi.GPIO\u7684\u66ff\u4ee3\u54c1\u800c\u521b\u5efa\u7684\u3002\u5b83\u5176\u5b9e\u6784\u5efa\u5728RPi.GPIO\u4e4b\u4e0a\uff0c\u65e8\u5728\u5e2e\u52a9\u521d\u5b66\u8005\u80fd\u591f\u5c3d\u53ef\u80fd\u8f7b\u677e\u5730\u4f7f\u7528RPi.GPIO\u3002<br \/>\n\u901a\u8fc7\u76f4\u63a5\u4f7f\u7528RPi.GPIO\uff0c\u60a8\u53ef\u4ee5\u66f4\u597d\u5730\u4e86\u89e3\u5185\u90e8\u7684\u8fd0\u884c\u64cd\u4f5c\uff0c\u5e76\u4e14\u4e3a\u4e4b\u540e\u7684\u9879\u76ee\u5f00\u53d1\u51fa\u66f4\u7cbe\u7ec6\u7684\u63a7\u5236\u529f\u80fd\u3002<br \/>\n\u901a\u8fc7GPIO Zero\u7684API\u60a8\u53ef\u4ee5\u5bf9\u4e0a\u62c9\u548c\u4e0b\u62c9\u7535\u963b\u3001\u9ad8\u6001\u52a8\u4f5c\u548c\u4f4e\u6001\u52a8\u4f5c\u5f15\u811a\u7b49\u8fdb\u884c\u4fee\u6539\u3002\u4f46\u662f\u5982\u679c\u60a8\u8fc7\u4e8e\u9891\u7e41\u7684\u4f7f\u7528\u5b83\uff0c\u90a3\u4e48\u5c31\u5931\u53bbGPIO\u5728\u7b80\u6613\u6027\u65b9\u9762\u7684\u4f18\u52bf\u4e86\u3002<br \/>\n<img decoding=\"async\" class=\"aligncenter size-full wp-image-9420\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO1.jpg\" alt=\"\" width=\"640\"><br \/>\n\u4f7f\u7528RPi.GPIO\u7684\u53e6\u4e00\u4e2a\u539f\u56e0\u662f\u9a87\u5ba2\u548c\u5236\u9020\u5546\u4eec\u5206\u4eab\u4e86\u8bb8\u591a\u4f7f\u7528\u4e86RPi.GPIO\u7684\u5f88\u68d2\u7684\u9879\u76ee\u3002\u4e00\u65e6\u60a8\u638c\u63e1\u4e86\u8fd9\u4e2a\u6a21\u5757\uff0c\u5c31\u610f\u5473\u7740\u8fd9\u4e2a\u9886\u57df\u7684\u5927\u95e8\u5c06\u4f1a\u5411\u60a8\u655e\u5f00\uff01<br \/>\n\u4e5f\u8bb8\u6709\u4e00\u5929\u60a8\u4f1a\u60f3\u4f7f\u7528\u8bf8\u5982C\u6216C++\u8fd9\u6837\u7684\u8bed\u8a00\u3002\u8fd9\u4e9b\u8bed\u8a00\u66f4\u9ad8\u7ea7\u4e00\u4e9b\uff0c\u4f46\u662f\u4f1a\u63d0\u4f9b\u66f4\u591a\u7684\u63a7\u5236\u529f\u80fd\u4ee5\u53ca\u4f7f\u786c\u4ef6\u7684\u4f7f\u7528\u66f4\u52a0\u9ad8\u6548\u7684\u529f\u80fd\u3002\u4f7f\u7528RPi.GPIO\u65e0\u6cd5\u8ba9\u60a8\u76f4\u63a5\u5b9e\u73b0\u8fd9\u4e2a\u76ee\u7684\uff0c\u4f46\u662f\u5b83\u53ef\u4ee5\u5e2e\u52a9\u60a8\u671d\u8fd9\u4e2a\u65b9\u5411\u8fc8\u8fdb\u3002<br \/>\n\u76ee\u524d\u4e0d\u7528\u62c5\u5fc3\u4f1a\u6d88\u8017\u8fc7\u591aCPU\u5468\u671f\u3002\u6bcf\u4e2aRaspberry Pi\u7684\u5904\u7406\u80fd\u529b\u90fd\u8fdc\u8fdc\u8d85\u8fc7\u672c\u9879\u76ee\u6240\u9700\u3002\u955c\u50cf\uff1aRaspberry Pi\u3002<\/p>\n<h3>\u5bfc\u5165RPi.GPIO\u5e93<\/h3>\n<p>\u5bfc\u5165RPi.GPIO\u6a21\u5757\u7684\u8bed\u6cd5\u662f\uff1a<br \/>\n<span style=\"color: #3366ff;\">import RPi.GPIO as GPIO<\/span><br \/>\n\u5b98\u65b9\u6587\u6863\u548c\u5927\u591a\u6570\u5df2\u53d1\u5e03\u7684\u9879\u76ee\u90fd\u9075\u5faa\u8be5\u8bed\u6cd5\u3002\u5982\u679c\u60a8\u4e5f\u4f7f\u7528\u8be5\u8bed\u53e5\uff0c\u53ef\u4ee5\u76f4\u63a5\u501f\u7528\u4ed6\u4eec\u7684\u4ee3\u7801\u3002<\/p>\n<h3>RPi.GPIO \u53ef\u8ba9\u60a8\u9009\u62e9\u5f15\u811a\u7f16\u53f7\u6a21\u5f0f<\/h3>\n<p>\u6709\u4e24\u79cd\u5bf9\u5f15\u811a\u8fdb\u884c\u7f16\u53f7\u7684\u65b9\u6cd5\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5b83\u4eec\u5728<a href=\"https:\/\/www.deviceplus.com\/raspberry-pi\/an-introduction-to-raspberry-pi-gpio-pins\/\">GPIO\u63a5\u5934<\/a>\u4e2d\u7684\u653e\u7f6e\u4f4d\u7f6e\u6765\u63cf\u8ff0\u8fd9\u4e9b\u5f15\u811a\uff0c\u8fd9\u79cd\u65b9\u6cd5\u79f0\u4e3a\u201c\u677f\u7f16\u53f7\u201d\u3002<br \/>\n\u60a8\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5b83\u4eec\u8fde\u63a5\u5230Raspberry Pi\u6838\u5fc3\u4e2dBroadcom\u82af\u7247\u7684\u987a\u5e8f\u6765\u5bf9\u5176\u8fdb\u884c\u63cf\u8ff0\u3002\u5982\u679c\u60a8\u89c9\u5f97GPIO\u5f15\u811a\u7f16\u53f7\u4e0e\u5176\u5728\u63a5\u5934\u4e2d\u7684\u4f4d\u7f6e\u65e0\u5173\uff0c\u53ef\u4ee5\u4f7f\u7528\u8be5\u65b9\u6cd5\u3002<br \/>\n\u60a8\u53ef\u4ee5\u4f7f\u7528RPi.GPIO\u2019s setmode\u51fd\u6570\u6765\u5bf9\u8fd9\u4e24\u79cd\u7f16\u53f7\u7cfb\u7edf\u8fdb\u884c\u9009\u62e9\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.setmode(GPIO.BOARD)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setmode(GPIO.BCM)<\/span><br \/>\n\u5982\u679c\u5728\u8bbe\u7f6e\u6a21\u5f0f\u4e4b\u524d\u5c31\u5206\u914d\u5f15\u811a\uff0c\u90a3\u4e48Python\u4f1a\u8fd4\u56de\u9519\u8bef\u4fe1\u606f\u3002<br \/>\n\u6211\u4e2a\u4eba\u66f4\u559c\u6b22Broadcom\u7f16\u53f7\u6a21\u5f0f\u3002\u56e0\u4e3a\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e0b\uff0c\u54ea\u4e9b\u5f15\u811a\u662fGPIO\u3001\u63a5\u5730\u6216\u7535\u6e90\u4f1a\u66f4\u6e05\u6670\u3002\u6211\u8fd8\u4f7f\u7528\u4e86GPIO\u6269\u5c55\u677f\u6765\u6784\u5efa\u9762\u5305\u677f\u539f\u578b\uff0c\u5e76\u4e14\u5728\u8be5\u677f\u4e0a\u6839\u636eGPIO\u7f16\u53f7\u5bf9\u6bcf\u4e2a\u5f15\u811a\u8fdb\u884c\u6807\u8bb0\u3002<br \/>\n\u6709\u4eba\u53ef\u80fd\u89c9\u5f97\u677f\u7f16\u53f7\u6a21\u5f0f\u66f4\u5bb9\u6613\u4e00\u4e9b\u3002\u5982\u679c\u8be5\u6a21\u5f0f\u9002\u7528\u4e8e\u60a8\u7684\u9879\u76ee\uff0c\u90a3\u4e5f\u5f88\u597d\uff01\u60a8\u53ef\u4ee5\u81ea\u884c\u9009\u62e9\u3002<br \/>\n\u5728\u672c\u6587\u7684\u5269\u4f59\u90e8\u5206\uff0c\u6211\u4eec\u5c06\u4f1a\u4f7f\u7528Broadcom\u7f16\u53f7\u6a21\u5f0f\u3002<br \/>\n\u5982\u679c\u60a8\u4f7f\u7528\u8fc7\u89e3\u91ca\u5668\uff0c\u5e76\u4e14\u5fd8\u8bb0\u4e86\u8bbe\u7f6e\u7684\u662f\u54ea\u79cd\u6a21\u5f0f\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.getmode()<\/span><\/p>\n<h3>\u8bbe\u7f6e\u53ca\u4f7f\u7528\u5f15\u811a<\/h3>\n<p>\u8bbe\u7f6e\u7f16\u53f7\u6a21\u5f0f\u540e\uff0c\u4f7f\u7528setup\u51fd\u6570\u6765\u5c06\u5f15\u811a\u5206\u914d\u4e3a\u8f93\u5165\u6216\u8f93\u51fa\u5f15\u811a\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(11, GPIO.OUT)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(12, GPIO.IN)<\/span><br \/>\n\u5bf9\u4e8e\u8f93\u5165\u5f15\u811a\uff0c\u60a8\u901a\u5e38\u9700\u8981\u8bbe\u7f6e\u4e00\u4e2a\u4e0a\u62c9\u6216\u4e0b\u62c9\u7535\u963b\u6765\u9632\u6b62\u6d6e\u52a8\u3002\u60a8\u53ef\u4ee5\u7528\u4ee5\u4e0b\u65b9\u5f0f\u6765\u8bbe\u7f6e\u8fd9\u4e9b\u7535\u963b\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)<\/span><br \/>\n\u8981\u8bfb\u53d6\u8f93\u5165\u5f15\u811a\u7684\u5f53\u524d\u72b6\u6001\uff0c\u8bf7\u4f7f\u7528\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.input(12)<\/span><br \/>\n\u60a8\u53ef\u4ee5\u4f7f\u7528output\u51fd\u6570\u6765\u5c06\u8f93\u51fa\u5f15\u811a\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\u6216\u4f4e\u7535\u5e73\uff0c\u5982\u4e0b\u6240\u793a\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.output(11, True)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(11, False)<\/span><\/p>\n<h3>\u4e3a\u5f15\u811a\u547d\u540d<\/h3>\n<p>\u5982\u679c\u60a8\u5c06\u5f15\u811a\u7f16\u53f7\u5206\u914d\u7ed9\u63cf\u8ff0\u6027\u547d\u540d\u7684\u53d8\u91cf\uff0c\u60a8\u7684\u4ee3\u7801\u5c06\u66f4\u5177\u53ef\u8bfb\u6027\uff0c\u5982\u4e0b\u6240\u793a\uff1a<br \/>\n<span style=\"color: #3366ff;\">redLED = 11<\/span><br \/>\n<span style=\"color: #3366ff;\">button = 12<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(redLED, GPIO.OUT)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(button, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(redLED, True)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.input(button)<\/span><br \/>\n\u7528\u8fd9\u79cd\u4ee3\u7801\u53ef\u4ee5\u66f4\u6e05\u695a\u5730\u663e\u793a\u6240\u6267\u884c\u7684\u64cd\u4f5c\uff0c\u4e0d\u662f\u5417\uff1f<br \/>\n\u60a8\u53ef\u80fd\u89c9\u5f97\u5373\u4f7f\u4e0d\u4f7f\u7528\u8fd9\u4e9b\u5b9e\u7528\u6807\u7b7e\uff0c\u9879\u76ee\u4e5f\u4f1a\u8fdb\u884c\u5f97\u5f88\u5bb9\u6613\uff0c\u4f46\u662f\u6700\u597d\u517b\u6210\u8fd9\u79cd\u4e60\u60ef\u3002\u5f53\u60a8\u9700\u8981\u6784\u5efa\u66f4\u590d\u6742\u7684\u9879\u76ee\u65f6\uff0c\u4ee5\u53ca\u6682\u65f6\u4e2d\u6b62\u6b63\u5728\u8fdb\u884c\u7684\u9879\u76ee\u65f6\uff0c\u6216\u8005\u5176\u4ed6\u4eba\u67e5\u770b\u60a8\u7684\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u4e60\u60ef\u4f1a\u7ed9\u60a8\u5e26\u6765\u5f88\u5927\u7684\u4fbf\u5229\u3002<\/p>\n<h3>\u5b8c\u6210\u540e\u6e05\u9664<\/h3>\n<p>\u5982\u679c\u60a8\u4fdd\u7559\u4e86\u5bf9\u8fd9\u4e9b\u5f15\u811a\u7684\u5206\u914d\u8bbe\u7f6e\uff0c\u5f88\u5bb9\u6613\u9020\u6210\u610f\u5916\u77ed\u8def\u4ece\u800c\u70e7\u574f\u7535\u8def\u677f\u3002<br \/>\n\u5f53\u811a\u672c\u8fd0\u884c\u7ed3\u675f\u6216\u8005\u60a8\u9000\u51fa\u89e3\u91ca\u5668\u65f6\uff0cGPIO Zero\u4f1a\u81ea\u52a8\u8fdb\u884c\u91cd\u7f6e\u3002\u5728RPi.GPIO\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4ee5\u4e0b\u51fd\u6570\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.cleanup()<\/span><br \/>\n\u8be5\u6e05\u9664\u51fd\u6570\u53ea\u4f1a\u5bf9\u60a8\u5728RPi.GPIO\u4e2d\u5206\u914d\u7684\u5f15\u811a\u8fdb\u884c\u91cd\u7f6e\uff0c\u6240\u4ee5\u5982\u679c\u6709\u53e6\u4e00\u4e2a\u8fdb\u7a0b\u6b63\u5728\u4f7f\u7528\u5176\u4ed6\u5f15\u811a\uff0c\u5219\u4e0d\u4f1a\u53d7\u5230\u5e72\u6270\u3002<br \/>\n\u60a8\u4e5f\u53ef\u4ee5\u91cd\u7f6e\u7279\u5b9a\u7684\u5f15\u811a\uff0c\u5c06\u8fd9\u4e9b\u5f15\u811a\u4f5c\u4e3a\u4e00\u4e2a\u53c2\u6570\u4f20\u9012\u5230\u51fd\u6570\u4e2d\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.cleanup(redLED)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.cleanup([redLED, button])<\/span><\/p>\n<h3>\u4f7f\u7528\u4ee5\u4e0a\u8bbe\u7f6e\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684LED\u5e8f\u5217<\/h3>\n<p>\u5bf9\u4e8e\u672c\u9879\u76ee\uff0c\u60a8\u5c06\u9700\u8981\uff1a<\/p>\n<table width=\"427\">\n<tbody>\n<tr>\n<td width=\"208\"><strong>\u4e00\u4e2a\u5e26\u7535\u6e90\u7684<\/strong><a href=\"https:\/\/thepihut.com\/products\/raspberry-pi-4-model-b?variant=20064052674622&amp;currency=GBP&amp;utm_medium=product_sync&amp;utm_source=google&amp;utm_content=sag_organic&amp;utm_campaign=sag_organic&amp;gclid=Cj0KCQjwlN32BRCCARIsADZ-J4s5VAXINFtbw9Of96pQszrsr3iA4kdZung_1ozb7Qjq6Kgl6Rku8h0aAsfUEALw_wcB\"><strong>Raspberry Pi<\/strong><\/a><strong>\u4ee5\u53ca\u4e00\u4e2a\u5b89\u88c5\u4e86<\/strong><a href=\"https:\/\/shop.pimoroni.com\/products\/noobs-32gb-microsd-card-3-1?variant=31703694245971\"><strong>Raspbian\u7684SD\u5361<\/strong><\/a><strong> installed<\/strong><\/td>\n<td width=\"219\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9422\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO2.jpg\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO2.jpg 159w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO2-50x41.jpg 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO2-92x75.jpg 92w\" sizes=\"auto, (max-width: 159px) 100vw, 159px\" width=\"159\" height=\"130\"><\/td>\n<\/tr>\n<tr>\n<td width=\"208\"><strong>\u4e00\u4e2a<\/strong><a href=\"https:\/\/uk.rs-online.com\/web\/p\/breadboards\/1029147\/\"><strong>\u9762\u5305\u677f<\/strong><\/a><\/td>\n<td width=\"219\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9423\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3.jpg\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3.jpg 225w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3-150x150.jpg 150w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3-146x146.jpg 146w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3-50x50.jpg 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3-75x75.jpg 75w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3-85x85.jpg 85w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO3-80x80.jpg 80w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" width=\"225\" height=\"225\"><\/td>\n<\/tr>\n<tr>\n<td width=\"208\"><strong>\u4e00\u4e2a<\/strong><a href=\"https:\/\/cpc.farnell.com\/pro-signal\/ctlcobblerassembled\/cobbler-assembled\/dp\/SC13285?mckv=sEV9OyYS1_dc|pcrid|224679642167|kword||match||plid||slid||product|SC13285|pgrid|47129782516|ptaid|pla-558431019053|&amp;CMP=KNC-GUK-CPC-SHOPPING&amp;gclid=Cj0KCQjwlN32BRCCARIsADZ-J4vR71czEfw4bB-nG9xvxmNcNZUQoeLChcTMYnOoWWlZ2QVZ38WiZugaAvJREALw_wcB\"><strong>GPIO\u6269\u5c55\u677f<\/strong><\/a><\/td>\n<td width=\"219\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9424\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO4.jpg\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO4.jpg 275w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO4-219x146.jpg 219w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO4-50x33.jpg 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO4-113x75.jpg 113w\" sizes=\"auto, (max-width: 275px) 100vw, 275px\" width=\"275\" height=\"183\"><\/td>\n<\/tr>\n<tr>\n<td width=\"208\"><strong>\u4e00\u4e2a<\/strong><a href=\"https:\/\/uk.rs-online.com\/web\/p\/leds\/0178970?cm_mmc=UK-PLA-DS3A-_-google-_-PLA_UK_EN_Displays_%26_Optoelectronics_Whoop-_-LEDs_Whoop-_-178970&amp;matchtype=&amp;aud-827186183886:pla-326231414324&amp;gclid=CjwKCAjwxLH3BRApEiwAqX9arap1kaE8Tcd7-aWbkMVd_tLmV0lLIt8Elu0KrB4ncZxti436z4IIHhoCCrEQAvD_BwE&amp;gclsrc=aw.ds\">\u7eff\u8272LED<\/a>\uff0c \u4e00\u4e2a<a href=\"https:\/\/uk.rs-online.com\/web\/p\/leds\/0178970?cm_mmc=UK-PLA-DS3A-_-google-_-PLA_UK_EN_Displays_%26_Optoelectronics_Whoop-_-LEDs_Whoop-_-178970&amp;matchtype=&amp;aud-827186183886:pla-326231414324&amp;gclid=CjwKCAjwxLH3BRApEiwAqX9arap1kaE8Tcd7-aWbkMVd_tLmV0lLIt8Elu0KrB4ncZxti436z4IIHhoCCrEQAvD_BwE&amp;gclsrc=aw.ds\">\u7ea2\u8272LED<\/a>\uff0c \u4ee5\u53ca\u4e00\u4e2a<a href=\"https:\/\/uk.rs-online.com\/web\/p\/leds\/3208588?cm_mmc=UK-PLA-DS3A-_-google-_-PLA_UK_EN_Displays_%26_Optoelectronics_Whoop-_-LEDs_Whoop-_-3208588&amp;matchtype=&amp;aud-826607885227:pla-299778180382&amp;gclid=CjwKCAjwxLH3BRApEiwAqX9arVbK8EORHlfIarArge2eWcmX3FjY64uRummfySbXLMjeXGdfZIoiyhoCOKEQAvD_BwE&amp;gclsrc=aw.ds\">\u9ec4\u8272LED<\/a><\/td>\n<td width=\"219\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9425\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO5.jpg\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO5.jpg 215w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO5-134x146.jpg 134w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO5-46x50.jpg 46w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO5-69x75.jpg 69w\" sizes=\"auto, (max-width: 215px) 100vw, 215px\" width=\"215\" height=\"235\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u60a8\u8fd8\u9700\u8981\u4e00\u4e2a\u53ef\u4ee5\u8ba9\u60a8\u8f93\u5165\u6307\u4ee4\u7684\u8bbe\u5907\uff0c\u4f8b\u5982SSH\u8fde\u63a5\u6216\u8005USB\u952e\u76d8\u548c\u9f20\u6807\uff0c\u51e0\u6839\u8de8\u63a5\u7535\u7f06\u4ee5\u53ca\u4e09\u4e2a\u963b\u503c\u5728220\u03a9~1000\u03a9\u4e4b\u95f4\u7684\u7535\u963b\u3002<\/p>\n<h3>\u8fde\u63a5\u6211\u4eec\u7684\u7ea2\u8272LED<\/h3>\n<p>\u9996\u5148\uff0c\u5c06GPIO\u6269\u5c55\u677f\u8fde\u63a5\u5230\u60a8\u7684Raspberry Pi GPIO\u63a5\u5934\u548c\u9762\u5305\u677f\uff08\u5982\u679c\u5c1a\u672a\u8fde\u63a5\u7684\u8bdd\uff09\u3002\u7136\u540e\u4f7f\u7528\u8de8\u63a5\u7535\u7f06\u5c06\u63a5\u5730\u5f15\u811a\u8fde\u63a5\u5230\u9762\u677f\u677f\u5e95\u90e8\u7684\u8d1f\u7535\u6e90\u8f68\u3002<br \/>\n<img decoding=\"async\" class=\"aligncenter size-full wp-image-9426\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO6.png\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO6.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO6-300x91.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO6-768x233.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO6-260x79.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO6-50x15.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO6-150x46.png 150w\" sizes=\"(max-width: 640px) 100vw, 640px\" width=\"640\"><br \/>\n\u73b0\u5728\u8fde\u63a5LED\u3002D\u4ee3\u8868\u7684\u662f\u4e8c\u6781\u7ba1\uff0c\u4e5f\u5c31\u662f\u8bf4\u7535\u6d41\u53ea\u80fd\u6cbf\u4e00\u4e2a\u65b9\u5411\u901a\u8fc7LED\u3002<br \/>\n\u60a8\u53ef\u4ee5\u8bc6\u522b\u51fa\u5e94\u8be5\u5982\u4f55\u8fde\u63a5LED\uff0c\u56e0\u4e3aLED\u7684\u4e00\u4e2a\u5f15\u811a\u6bd4\u53e6\u4e00\u4e2a\u7a0d\u957f\u3002\u8f83\u957f\u7684\u5f15\u811a\u662f\u9633\u6781\uff0c\u8fde\u63a5\u5230\u6b63\u6781\uff0c\u8f83\u77ed\u7684\u662f\u9634\u6781\uff0c\u8fde\u63a5\u5230\u8d1f\u6781\u3002<br \/>\n\u5728\u8fd9\u4e2a\u7535\u8def\u4e2d\uff0c\u6211\u4eec\u5c06\u628a\u8f83\u957f\u7684\u5f15\u811a\u2014\u9633\u6781\u2014\u8fde\u63a5\u5230GPIO\u5f15\u811a\uff0c\u628a\u8f83\u77ed\u7684\u5f15\u811a\u2014\u9634\u6781\u2014\u8fde\u63a5\u5230\u8d1f\u7535\u6e90\u8f68\u3002<br \/>\n\u9996\u5148\u5c06\u7ea2\u8272LED\u653e\u5728\u60a8\u7684\u9762\u5305\u677f\u4e0a\uff0c\u8ddd\u79bb\u6269\u5c55\u677f\u4e0d\u8fdc\u3002\u6c34\u5e73\u653e\u7f6eLED\u5f15\u811a\uff0c\u4f7f\u9633\u6781\u66f4\u9760\u8fd1\u6269\u5c55\u677f\u3002\u7136\u540e\u5c06GPIO\u5f15\u811a\uff08\u6211\u4f7f\u7528\u7684\u662f\u5f15\u811a13\uff09\u8fde\u63a5\u5230\u9633\u6781\u3002<br \/>\n<img decoding=\"async\" class=\"aligncenter size-full wp-image-9427\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO7.png\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO7.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO7-300x91.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO7-768x233.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO7-260x79.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO7-50x15.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO7-150x45.png 150w\" sizes=\"(max-width: 640px) 100vw, 640px\" width=\"640\"><br \/>\n\u73b0\u5728\u4f7f\u7528\u4e00\u4e2a\u7535\u963b\u6765\u5c06\u9634\u6781\u8fde\u63a5\u5230\u8d1f\u7535\u6e90\u8f68\u3002\u4f7f\u7528\u7535\u963b\u5f88\u91cd\u8981\uff0c\u5426\u5219LED\u5c06\u4f1a\u4f7f\u7528\u8fc7\u5927\u7684\u7535\u6d41\u4ece\u800c\u70e7\u574f\u60a8\u7684Raspberry Pi\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9428\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO8.png\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO8.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO8-300x91.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO8-768x233.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO8-260x79.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO8-50x15.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO8-150x45.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" width=\"640\" height=\"210\"><\/p>\n<h3>\u6d4b\u8bd5\u7ea2\u8272LED<\/h3>\n<p>\u9996\u5148\u542f\u52a8Python\u89e3\u91ca\u5668\uff0c\u8f93\u5165\uff1a<br \/>\n<span style=\"color: #3366ff;\">python3<\/span><br \/>\n\u8ba9\u6211\u4eec\u52a0\u8f7dRPi.GPIO\uff0c\u5e76\u8bbe\u7f6e\u5f15\u811a\u7f16\u53f7\u6a21\u5f0f\uff0c\u8bf7\u8bb0\u5f97Python\u5bf9\u5927\u5c0f\u5199\u5f88\u654f\u611f\u3002<br \/>\n<span style=\"color: #3366ff;\">import RPi.GPIO as GPIO<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setmode(GPIO.BCM)<\/span><br \/>\n\u8fd8\u8bb0\u5f97\u4e4b\u524d\u4e3a\u5f15\u811a\u7f16\u53f7\u63d0\u4f9b\u5b9e\u7528\u540d\u79f0\u7684\u5efa\u8bae\u5417\uff1f\u5728\u8fd9\u91cc\u6211\u4eec\u4e5f\u8fd9\u6837\u505a\u3002<br \/>\n<span style=\"color: #3366ff;\">redLED = 13<\/span><br \/>\n\u73b0\u5728\uff0c\u5c06\u8be5\u5f15\u811a\u5206\u914d\u4e3a\u8f93\u51fa\u5f15\u811a\uff0c\u8f93\u5165\u4ee5\u4e0b\u6307\u4ee4\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(redLED, GPIO.OUT)<\/span><br \/>\n\u5982\u679c\u4e00\u5207\u8fde\u63a5\u6b63\u786e\uff0c\u60a8\u5c06\u80fd\u591f\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\u6765\u6253\u5f00\u548c\u5173\u95edLED\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.output(redLED, True)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(redLED, False)<\/span><br \/>\n\u5982\u679c\u6ca1\u6709\u6b63\u5e38\u5de5\u4f5c\uff0c\u8bf7\u68c0\u67e5LED\u7684\u8fde\u63a5\u65b9\u5411\u662f\u5426\u6b63\u786e\uff0c\u4ee5\u53ca\u6240\u6709\u8fde\u63a5\u662f\u5426\u6b63\u786e\u3002\u4e5f\u8bb8\u662f\u56e0\u4e3a\u7535\u963b\u7ebf\u63a5\u89e6\u4e0d\u826f\u9020\u6210\u7535\u8def\u6ca1\u6709\u63a5\u901a\u3002<\/p>\n<h3>\u8fde\u63a5\u5e76\u6d4b\u8bd5\u9ec4\u8272\u548c\u7eff\u8272LED<\/h3>\n<p>\u5728\u7ea2\u8272LED\u7684\u53f3\u4fa7\u653e\u7f6e\u9ec4\u8272LED\u3002\u4ee5\u53ca\uff0c\u518d\u6b21\u5c06\u5f15\u811a\u6c34\u5e73\u653e\u7f6e\uff0c\u5e76\u4f7f\u9633\u6781\u66f4\u9760\u8fd1\u6269\u5c55\u677f\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9429\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO9.png\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO9.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO9-300x94.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO9-768x240.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO9-260x81.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO9-50x16.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO9-150x47.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" width=\"640\" height=\"210\"><br \/>\n\u7136\u540e\u5c06\u8de8\u63a5\u7535\u7f06\u4eceGPIO\u5f15\u811a\uff08\u6211\u4f7f\u7528\u7684\u662f\u5f15\u811a16\uff09\u8fde\u63a5\u5230\u9ec4\u8272LED\u7684\u9633\u6781\u3002\u50cf\u4e4b\u524d\u6240\u505a\u7684\u90a3\u6837\uff0c\u4f7f\u7528\u7535\u963b\u5c06\u9634\u6781\u8fde\u63a5\u5230\u8d1f\u8f68\u3002<br \/>\n\u73b0\u5728\u4e3a\u8be5\u5f15\u811a\u547d\u540d\uff0c\u5c06\u5176\u5206\u914d\u4e3a\u8f93\u51fa\u5f15\u811a\uff0c\u5e76\u4e14\u6d4b\u8bd5\u662f\u5426\u53ef\u4ee5\u6253\u5f00\u548c\u5173\u95edLED\uff1a<br \/>\n<span style=\"color: #3366ff;\">yellowLED = 16<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(yellowLED, GPIO.OUT)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(yellowLED, True)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(yellowLED, False)<\/span><br \/>\n\u4e00\u5207\u6b63\u5e38\u5417\uff1f\u5982\u679c\u4e0d\u662f\u7684\u8bdd\uff0c\u8bf7\u68c0\u67e5LED\u7684\u65b9\u5411\u662f\u5426\u6b63\u786e\uff0c\u4ee5\u53ca\u6240\u6709\u7684\u8fde\u63a5\u662f\u5426\u6b63\u786e\u3002<br \/>\n\u63a5\u4e0b\u6765\u662f\u7eff\u8272LED\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9430\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO10.png\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO10.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO10-300x91.png 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO10-768x234.png 640w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO10-260x79.png 260w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO10-50x15.png 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO10-150x46.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" width=\"640\" height=\"210\"><br \/>\n\u5c06\u5b83\u5e76\u6392\u653e\u7f6e\u5728\u9762\u5305\u677f\u4e0a\uff0c\u5f15\u811a\u4ee5\u4e00\u5b9a\u7684\u95f4\u9694\u6c34\u5e73\u653e\u7f6e\uff0c\u9633\u6781\u9760\u8fd1\u6269\u5c55\u677f\u3002\u4f7f\u7528\u8de8\u63a5\u7ebf\u5c06\u9633\u6781\u8fde\u63a5\u5230GPIO\u5f15\u811a\uff08\u6211\u4f7f\u7528\u7684\u662f\u5f15\u811a21\uff09\uff0c\u7136\u540e\u4f7f\u7528\u4e00\u4e2a\u7535\u963b\u5c06\u9634\u6781\u8fde\u63a5\u5230\u8d1f\u8f68\uff0c\u63a5\u7740\u8f93\u5165\u4e00\u4e9bPython\u4ee3\u7801\uff1a<br \/>\n<span style=\"color: #3366ff;\">greenLED = 21<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.setup(greenLED, GPIO.OUT)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(greenLED, True)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(greenLED, False)<\/span><br \/>\n\u5c31\u662f\u8fd9\u6837\uff01<\/p>\n<h3>\u7f16\u5199\u7a0b\u5e8f\u4f7fLED\u6309\u7167\u987a\u5e8f\u70b9\u4eae<\/h3>\n<p>\u4e3a\u4e86\u9632\u6b62\u8fd0\u884c\u5f97\u592a\u5feb\u800c\u770b\u4e0d\u5230\u70b9\u4eae\u8fc7\u7a0b\uff0c\u6211\u4eec\u5c06\u4f1a\u4f7f\u7528sleep\u6307\u4ee4\uff0c\u8f93\u5165\uff1a<br \/>\n<span style=\"color: #3366ff;\">from time import sleep<\/span><br \/>\n\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u5c06\u6240\u6709\u5f15\u811a\u7f16\u53f7\u653e\u5165\u4e00\u4e2a\u53ef\u4ee5\u5faa\u73af\u904d\u5386\u7684\u5143\u7ec4\u4e2d\uff1a<br \/>\n<span style=\"color: #3366ff;\">LEDs = (redLED, yellowLED, greenLED)<\/span><br \/>\n\u6700\u540e\uff0c\u7f16\u5199\u4e00\u4e2afor\u5faa\u73af\u8bed\u53e5\u6765\u904d\u5386\u8fd9\u4e2a\u5143\u7ec4\uff0c\u4ece\u800c\u6253\u5f00\u548c\u5173\u95edLED\u3002\u8bf7\u8bb0\u4f4fPython\u5bf9\u7f29\u8fdb\u5f88\u654f\u611f\uff01<br \/>\n<span style=\"color: #3366ff;\">for i in range(100):<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(LEDs[i % 3], True)<\/span><br \/>\n<span style=\"color: #3366ff;\">sleep(2)<\/span><br \/>\n<span style=\"color: #3366ff;\">GPIO.output(LEDs[i % 3], False)<\/span><br \/>\n\u518d\u6b21\u6309\u4e0b\u56de\u8f66\u952e\u8fd0\u884c\u8be5\u5faa\u73af\u3002<br \/>\n\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u5c06\u4f1a\u770b\u5230LED\u6309\u7167\u987a\u5e8f\u4e00\u4e2a\u63a5\u4e00\u4e2a\u4eae\u8d772\u79d2\u949f\u3002\u8fd9\u9700\u8981\u82b1\u8d39\u51e0\u5206\u949f\u6765\u8fd0\u884c\uff0c\u60a8\u4e5f\u53ef\u4ee5\u6309ctrl+C\u6765\u7ed3\u675f\u8be5\u7a0b\u5e8f\u3002<br \/>\n\u5982\u679c\u60a8\u4e0d\u660e\u767d\u8be5\u5faa\u73af\u7684\u5de5\u4f5c\u539f\u7406\uff0c\u4ee5\u4e0b\u94fe\u63a5\u53ef\u80fd\u4f1a\u6709\u6240\u5e2e\u52a9\uff1a<br \/>\n\u2022 for \u5faa\u73af<br \/>\n\u2022 range \u51fd\u6570<br \/>\n\u2022 \u53d6\u6a21\u8fd0\u7b97\uff08%\uff09<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9431 size-full\" src=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO11-e1595083401367.jpg\" alt=\"\" srcset=\"https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO11-e1595083401367.jpg 571w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO11-e1595083401367-300x225.jpg 300w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO11-e1595083401367-195x146.jpg 195w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO11-e1595083401367-50x37.jpg 50w, https:\/\/www.deviceplus.com\/wp-content\/uploads\/2020\/07\/GPIO11-e1595083401367-100x75.jpg 100w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" width=\"571\" height=\"428\"><\/p>\n<h3>\u6e05\u9664<\/h3>\n<p>\u5b8c\u6210\u4e4b\u540e\u4e0d\u8981\u5fd8\u8bb0\u6e05\u9664\u5f15\u811a\u8bbe\u7f6e\uff01\u8f93\u5165\uff1a<br \/>\n<span style=\"color: #3366ff;\">GPIO.cleanup()<\/span><br \/>\n\u60a8\u53ef\u4ee5\u6309ctrl+D\u9000\u51fa\u89e3\u91ca\u5668\u3002\u955c\u50cf\uff1aFinished Product<\/p>\n<h3>\u8fd9\u662f\u7b80\u5355\u800c\u5f3a\u5927\u7684\u4ea7\u54c1<\/h3>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e9b\u57fa\u672c\u539f\u7406\u6765\u5b8c\u6210\u5f88\u591a\u4e8b\u60c5\uff0c\u5c24\u5176\u662f\u5728\u52a0\u5165\u8f93\u5165\u5f15\u811a\u4e4b\u540e\u3002\u8bf7\u7ee7\u7eed\u5173\u6ce8\u540e\u7eed\u5de5\u4f5c\uff01<\/p>\n<div class=\"author-box-wrapper\">\n<div class=\"avatar-wrapper\">\n\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/micro.wfjydl.com\/deviceplus\/wp-content\/uploads\/2018\/08\/Device-Plus-logo-for-author-info-75x75.png\" alt=\"DevicePlus \u7f16\u8f91\u56e2\u961f\" width=\"64\" height=\"64\"><\/div>\n<div class=\"desc-wrapper\">\n<h5>DevicePlus \u7f16\u8f91\u56e2\u961f<\/h5>\n<div class=\"desc\">\n\u8bbe\u5907\u5347\u7ea7\u7248\u9002\u7528\u4e8e\u6240\u6709\u70ed\u7231\u7535\u5b50\u548c\u673a\u7535\u4e00\u4f53\u5316\u7684\u4eba\u3002\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u8fd9\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8eDevicePlus.com\u82f1\u8bed\u7f51\u7ad9\u7684\u7ffb\u8bd1\u7a3f\u3002\u57282016\u5e74\u63a8\u51faGPIO Zero\u4e4b\u524d\uff0c\u65b0\u7528\u6237\u901a\u5e38\u4f7f\u7528\u53e6\u4e00\u4e2aPython\u6a21\u5757\uff08RPi.GPIO\uff09\u6765\u4f7f\u7528GPIO\u5f15\u811a\u3002 \u4f7f\u7528RPi.GPIO\u9700\u8981\u5b66\u4e60\u66f4\u591a\u7684\u76f8\u5173\u77e5\u8bc6 [&hellip;]","protected":false},"author":7,"featured_media":16005,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1132],"tags":[],"class_list":["post-12507","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry"],"acf":[],"wps_subtitle":"","_links":{"self":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/12507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/comments?post=12507"}],"version-history":[{"count":1,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/12507\/revisions"}],"predecessor-version":[{"id":16006,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/12507\/revisions\/16006"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media\/16005"}],"wp:attachment":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media?parent=12507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/categories?post=12507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/tags?post=12507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}