{"id":21082,"date":"2022-09-22T00:00:48","date_gmt":"2022-09-21T16:00:48","guid":{"rendered":"https:\/\/techclass.wfjydl.com\/?p=21082"},"modified":"2026-04-30T10:53:05","modified_gmt":"2026-04-30T02:53:05","slug":"%e7%94%a8raspberry-pi%e5%92%8c%e4%bc%a0%e6%84%9f%e5%99%a8%e5%88%b6%e4%bd%9c%e5%8f%af%e8%87%aa%e5%8a%a8%e8%90%a5%e9%80%a0%e8%88%92%e9%80%82%e7%a9%ba%e9%97%b4%e7%9a%84%e8%a3%85%e7%bd%ae-2","status":"publish","type":"post","link":"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-comfortable-space-device-03\/","title":{"rendered":"\u7528Raspberry Pi\u548c\u4f20\u611f\u5668\u5236\u4f5c\u201c\u53ef\u81ea\u52a8\u8425\u9020\u8212\u9002\u7a7a\u95f4\u7684\u88c5\u7f6e\u201d \u7b2c\u4e09\u90e8\u5206"},"content":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u5409\u7530\uff01<br \/>\n\u6211\u4eec\u8fd9\u6b21\u8981\u521b\u4f5c\u4e00\u6b3e\u8ba9\u5bb6\u4e2d\u66f4\u8212\u9002\u3001\u8ba9\u5728\u5bb6\u529e\u516c\u66f4\u9ad8\u6548\u7684\u8bbe\u5907\uff0c\u672c\u6587\u662f\u7b2c\u4e09\u90e8\u5206\u3002<br \/>\n\u5728<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-comfortable-space-device-02\/\">\u7b2c\u4e8c\u90e8\u5206<\/a>\u4e2d\uff0c\u6211\u4eec\u7528BLE\u8fde\u63a5\u4e86\u7f57\u59c6SensorMedal\u5e76\u6d4b\u91cf\u4e86\u5404\u79cd\u6570\u636e\u3002\u5728\u7b2c\u4e09\u90e8\u5206\uff0c\u6211\u5e0c\u671b\u901a\u8fc7\u5b89\u88c5\u4eba\u4f53\u4f20\u611f\u5668\u7b49\u5668\u4ef6\uff0c\u5b9e\u73b0\u68c0\u67e5\u4e3b\u4eba\u662f\u5426\u4e45\u5750\u4e0d\u52a8\u6216\u8fc7\u5ea6\u5de5\u4f5c\u7684\u529f\u80fd\uff01<br \/>\n<a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-1.jpg\" rel=\"attachment wp-att-26528\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26528\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-1.jpg\" sizes=\"auto, (max-width: 902px) 100vw, 902px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-1.jpg 902w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-1.jpg 300w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-1.jpg 768w\" alt=\"raspberrypi-comfortable-space-device-03-1\" width=\"902\" height=\"522\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>\u672c\u90e8\u5206\u6240\u9700\u90e8\u4ef6<\/h2>\n<h3><a href=\"https:\/\/www.amazon.co.jp\/%E3%83%A9%E3%82%BA%E3%83%99%E3%83%AA%E3%83%BC%E3%83%91%E3%82%A4-%E9%96%8B%E7%99%BA%E3%83%9C%E3%83%BC%E3%83%89-LAN%EF%BC%8DRaspberry-Model-%E3%80%90%E6%AD%A3%E8%A6%8F%E5%93%81%E3%80%91\/dp\/B07K4DN1SJ\/ref=sr_1_3?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;dchild=1&amp;keywords=Raspberry+Pi+3+B%2B&amp;qid=1591084366&amp;s=computers&amp;sr=1-3\" target=\"_blank\" rel=\"noopener\">Raspberry Pi 3 B+<\/a> \u6216 <a href=\"https:\/\/amzn.to\/2M3qH5e\" target=\"_blank\" rel=\"noopener\">Raspberry Pi 4 Model B<\/a><\/h3>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/3-1.jpg\" rel=\"attachment wp-att-26486\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26486\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/3-1.jpg\" sizes=\"auto, (max-width: 412px) 100vw, 412px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/3-1.jpg 412w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/3-1.jpg 300w\" alt=\"3\" width=\"412\" height=\"310\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Raspberry Pi 3 B+<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/4-1.jpg\" rel=\"attachment wp-att-26487\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26487\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/4-1.jpg\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/4-1.jpg 474w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/4-1.jpg 300w\" alt=\"4\" width=\"474\" height=\"334\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Raspberry Pi 4 Model B<\/p>\n<p>&nbsp;<\/p>\n<h3><a href=\"https:\/\/jp.rs-online.com\/web\/p\/sensor-development-kits\/1812214?sra=pmpn\" target=\"_blank\" rel=\"noopener\">\u7f57\u59c6SensorMedal<\/a>\uff08SensorMedal-EVK-002\uff09<\/h3>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/5-1.jpg\" rel=\"attachment wp-att-26488\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26488\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/5-1.jpg\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/5-1.jpg 416w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/5-1.jpg 300w\" alt=\"5\" width=\"416\" height=\"298\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gM-09002\/\" target=\"_blank\" rel=\"noopener\">\u70ed\u91ca\u7535\u7ea2\u5916\u7ebf\u4f20\u611f\u5668<\/a> (SB412A)<\/h3>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-5.jpg\" rel=\"attachment wp-att-26532\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26532\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-5.jpg\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-5.jpg 370w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-5.jpg 285w\" alt=\"raspberrypi-comfortable-space-device-03-5\" width=\"370\" height=\"390\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><a href=\"https:\/\/amzn.to\/2XFu5Jb\" target=\"_blank\" rel=\"noopener\">Raspberry Pi\u7528\u6db2\u6676\u663e\u793a\u5668<\/a><\/h3>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg\" rel=\"attachment wp-att-26533\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26533\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg 476w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg 300w\" alt=\"raspberrypi-comfortable-space-device-03-6\" width=\"476\" height=\"370\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>\u672c\u90e8\u5206\u7684\u6d41\u7a0b<\/h2>\n<ol>\n<li>\u7ed9Raspberry Pi\u8fde\u63a5\u4eba\u4f53\u4f20\u611f\u5668<\/li>\n<li>\u6dfb\u52a0\u6db2\u6676\u663e\u793a\u5668<\/li>\n<li>\u603b\u7ed3<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>1. \u7ed9Raspberry Pi\u8fde\u63a5\u4eba\u4f53\u4f20\u611f\u5668<\/h2>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-comfortable-space-device-02\/\">\u7b2c\u4e8c\u90e8\u5206<\/a>\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7\u7f57\u59c6SensorMedal\u6d4b\u91cf\u4e86\u4eae\u5ea6\uff0c\u5e76\u6839\u636e\u4eae\u5ea6\u503c\u6210\u529f\u63a7\u5236\u4e86USB\u706f\u3002\u5728\u7b2c\u4e8c\u90e8\u5206\u7684\u57fa\u7840\u4e0a\uff0c\u8fd8\u53ef\u4ee5\u68c0\u6d4b\u6e29\u5ea6\u548c\u6e7f\u5ea6\uff0c\u5f53\u68c0\u6d4b\u5230\u5ba4\u6e29\u8fc7\u9ad8\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u540c\u6837\u7684\u65b9\u6cd5\u8ba9\u98ce\u6247\u8f6c\u8d77\u6765\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u4ec5\u4ec5\u8fd9\u6837\u7684\u529f\u80fd\u53ef\u80fd\u8fd8\u4e0d\u591f\uff0c\u6211\u8fd8\u5e0c\u671b\u5b83\u53ea\u5728\u88c5\u6709\u8fd9\u6b3eRaspberry Pi\u8bbe\u5907\u7684\u5de5\u4f5c\u53f0\u5468\u56f4\u6709\u4eba\u65f6\u624d\u5de5\u4f5c\uff01<\/p>\n<p>\u53e6\u5916\uff0c\u6b63\u5982\u6211\u5728<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-comfortable-space-device-01\/\">\u7b2c\u4e00\u90e8\u5206<\/a>\u4e2d\u63d0\u5230\u7684\uff0c\u6211\u8fd8\u5e0c\u671b\u5b83\u80fd\u8d77\u5230\u9632\u6b62\u4e3b\u4eba\u5728\u5bb6\u529e\u516c\u671f\u95f4\u56e0\u4e45\u5750\u4e0d\u52a8\u800c\u8fc7\u4e8e\u75b2\u52b3\u7684\u4f5c\u7528\u3002<\/p>\n<table>\n<tbody>\n<tr bgcolor=\"#e0ffff\">\n<td>\u7f16\u53f7<\/td>\n<td>\u68c0\u6d4b\u529f\u80fd<\/td>\n<td>\u68c0\u6d4b\u540e\u5e0c\u671b\u5177\u5907\u7684\u529f\u80fd<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u68c0\u6d4b\u5750\u5728\u6905\u5b50\u4e0a\u7684\u65f6\u95f4<\/td>\n<td>\u68c0\u6d4b\u5230\u5750\u7684\u65f6\u95f4\u592a\u4e45\uff08\u4e45\u5750\u4e0d\u52a8\uff09\uff0c\u7763\u4fc3\u4e3b\u4eba\u7ad9\u8d77\u6765\u6d3b\u52a8\u6d3b\u52a8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6240\u4ee5\uff0c\u8fd9\u6b21\u6211\u4eec\u6765\u5b9e\u73b0\u4e0a\u8ff0\u529f\u80fd\uff0c\u8fd9\u4e5f\u662f<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-comfortable-space-device-01\/\">\u7b2c\u4e00\u90e8\u5206<\/a>\u4e2d\u5217\u4e3e\u7684\u201c\u8981\u662f\u6709\u8fd9\u6837\u7684\u529f\u80fd\u5c31\u597d\u4e86\u201d\u7684\u9879\u76ee\u4e4b\u4e00\u3002\u5177\u4f53\u6765\u8bb2\uff0c\u9700\u8981\u6dfb\u52a0\u4e00\u4e2a\u80fd\u591f\u8ba9Raspberry Pi\u77e5\u9053\u662f\u5426\u6709\u4eba\u7684\u4f20\u611f\u5668\uff0c\u4ee5\u4fbf\u786e\u8ba4\u5de5\u4f5c\u53f0\u5468\u56f4\u7684\u6d3b\u52a8\u72b6\u6001\u3002\u4e3a\u6b64\uff0c\u6211\u4eec\u5c06\u5728Raspberry Pi\u4e0a\u5b89\u88c5\u4e0b\u9762\u8fd9\u79cd\u70ed\u91ca\u7535\u7ea2\u5916\u7ebf\u4f20\u611f\u5668\u3002<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-7.jpg\" rel=\"attachment wp-att-26534\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26534\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-7.jpg\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-7.jpg 428w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-7.jpg 284w\" alt=\"raspberrypi-comfortable-space-device-03-7\" width=\"428\" height=\"452\" \/><\/a><\/p>\n<table>\n<tbody>\n<tr bgcolor=\"#e0ffff\">\n<td style=\"width: 50%;\">\u4f20\u611f\u5668\u4fa7\uff08\u4ece\u7167\u7247\u5de6\u8fb9\u5f00\u59cb\uff09<\/td>\n<td>Raspberry Pi\u4fa7<\/td>\n<\/tr>\n<tr>\n<td>\uff0b\uff08\u9ec4\u8272\uff09<\/td>\n<td>5V<\/td>\n<\/tr>\n<tr>\n<td>OUT\uff08\u7ea2\u8272\uff09<\/td>\n<td>GPIO13<\/td>\n<\/tr>\n<tr>\n<td>\u30fc\uff08\u9ed1\u8272\uff09<\/td>\n<td>GND<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u4e0eRaspberry Pi\u7684\u8fde\u63a5\u5982\u8868\u4e2d\u6240\u793a\u3002\u5b9e\u9645\u5b89\u88c5\u7684\u7167\u7247\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-8.jpg\" rel=\"attachment wp-att-26535\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26535\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-8.jpg\" alt=\"raspberrypi-comfortable-space-device-03-8\" width=\"600\" height=\"496\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u8fd9\u91cc\uff0c\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u7a0b\u5e8fhuman.py\uff0c\u6765\u786e\u8ba4\u4eba\u4f53\u4f20\u611f\u5668\u662f\u5426\u6b63\u5e38\u53d1\u6325\u4f5c\u7528\uff0c\u5728\u8fd0\u884c\u8be5\u7a0b\u5e8f\u65f6\uff0c\u5982\u679c\u5468\u56f4\u6709\u4eba\uff0c\u5c06\u663e\u793a\u4e3a\u201c1\u201d\uff0c\u5426\u5219\u663e\u793a\u4e3a\u201c0\u201d\u3002<\/p>\n<p><strong>[human.py]<\/strong><\/p>\n<pre class=\"brush: cpp; title: Code-Example; notranslate\" title=\"Code-Example\">import RPi.GPIO as GPIO\r\nfrom time import sleep\r\n\r\nhuman_pin = 13\r\nGPIO.setmode(GPIO.BCM)\r\nGPIO.setup(human_pin, GPIO.IN)\r\n\r\ntry:\r\n    while True:\r\n        human = GPIO.input(human_pin)\r\n        print(human)\r\n        sleep(1)\r\n\r\nexcept KeyboardInterrupt:\r\n    pass\r\n\r\nGPIO.cleanup()\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8fd0\u884chuman.py\u3002\u4ec5\u5f53\u60a8\u5750\u5728Raspberry Pi\u524d\u9762\u6216\u5c06\u624b\u9760\u8fd1\u5b83\u65f6\u624d\u4f1a\u663e\u793a\u201c1\u201d\u3002<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-10.png\" rel=\"attachment wp-att-26537\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26537\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-10.png\" alt=\"raspberrypi-comfortable-space-device-03-10\" width=\"500\" height=\"160\" \/><\/a><\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-9.jpg\" rel=\"attachment wp-att-26536\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26536\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-9.jpg\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-9.jpg 576w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-9.jpg 300w\" alt=\"raspberrypi-comfortable-space-device-03-9\" width=\"576\" height=\"482\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>2. \u6dfb\u52a0\u6db2\u6676\u663e\u793a\u5668<\/h2>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u6765\u7ed9Raspberry Pi\u52a0\u4e00\u4e2a\u6db2\u6676\u663e\u793a\u5668\uff0c\u4f7f\u4e4b\u80fd\u591f\u663e\u793a\u524d\u9762\u6dfb\u52a0\u7684SensorMedal\u548c\u4eba\u4f53\u4f20\u611f\u5668\u7684\u503c\u3002<\/p>\n<p>\u5e02\u573a\u4e0a\u6709\u5f88\u591a\u79cd\u6db2\u6676\u663e\u793a\u5668\uff0c\u6211\u9009\u7528\u7684\u662f\u53ea\u9700\u5c06\u5176\u63d2\u5165Raspberry Pi\u7684GPIO\u5f15\u811a\u5373\u53ef\u4f7f\u7528\u7684DISPLAYOTRON HAT\uff0c\u5b83\u4e5f\u6709\u4e00\u4e2a\u53ef\u4ee5\u8fde\u63a5\u4eba\u4f53\u4f20\u611f\u5668\u7684GPIO\u5f15\u811a\u3002<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg\" rel=\"attachment wp-att-26533\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26533\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg 476w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-6.jpg 300w\" alt=\"raspberrypi-comfortable-space-device-03-6\" width=\"476\" height=\"370\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u5982\u7167\u7247\u6240\u793a\uff0c\u5c06\u663e\u793a\u5668\u63d2\u5165Raspberry Pi\u7684 GPIO\u5f15\u811a\u3002<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-11.jpg\" rel=\"attachment wp-att-26540\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26540\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-11.jpg\" alt=\"raspberrypi-comfortable-space-device-03-11\" width=\"600\" height=\"449\" \/><\/a><\/p>\n<p>\u8fd9\u4e2a\u663e\u793a\u5668\u7684\u5e93\u6765\u81ea Adafruit\uff0c\u6240\u4ee5\u53ef\u4ee5\u53c2\u8003\u5176Github\u9875\u9762\uff1a<br \/>\n<a href=\"https:\/\/github.com\/pimoroni\/displayotron\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/pimoroni\/displayotron<\/a><\/p>\n<p>\u8fd0\u884c\u9875\u9762\u4e2d\u7684\u5b89\u88c5\u811a\u672c\u3002\u8fd9\u6837\u5c06\u4f1a\u5728Home\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cpimoroni\u201d\u7684\u76ee\u5f55\uff0c\u5e76\u5728\u5176\u4e2d\u7684\u4e0b\u8ff0\u4f4d\u7f6e\u4fdd\u5b58\u793a\u4f8b\u7a0b\u5e8f\u3002<\/p>\n<p>Dot3000\u548cDotHat\u90fd\u6709\u7c7b\u4f3c\u7684\u529f\u80fd\uff0c\u4f46\u662f\u8fd9\u6b21\u6211\u4f7f\u7528\u7684\u662fDotHat\uff0c\u6240\u4ee5\u6211\u4eec\u4f1a\u4f7f\u7528DotHat\u5bf9\u5e94\u7684\u5e93\u3002\u8fd9\u91cc\u6709\u4e00\u4e9b\u793a\u4f8b\u7a0b\u5e8f\uff0c\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u8fd0\u884c\u4e00\u4e0b\u3002<\/p>\n<pre class=\"brush: cpp; title: Code-Example; notranslate\" title=\"Code-Example\">$ curl -sS get.pimoroni.com\/displayotron | bash\r\n$ cd \/home\/pi\/Pimoroni\/displayotron\/dothat\r\n$ python3 basic\/hello_world.py\r\n$ python3 basic\/backlight.py \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4e0b\u9762\uff0c\u8ba9\u6211\u4eec\u4fee\u6539\u4e00\u4e0b\u8fde\u63a5SensorMedal\u548cRaspberry Pi\u7684\u7a0b\u5e8f\uff0c\u4ee5\u5b9e\u73b0\u5728\u8fd9\u4e2a\u6db2\u6676\u663e\u793a\u5668\u4e0a\u663e\u793a\u6d4b\u91cf\u503c\u3002\u4e0b\u9762\u7684\u7b2c4\u884c\u3001\u7b2c22\u301c27\u884c\u3001\u7b2c45\u301c50\u884c\u548c\u7b2c91\u301c115\u884c\u662f\u5bf9\u7b2c\u4e8c\u90e8\u5206\u4e2dble\u7a0b\u5e8f\u7684\u8865\u5145\u3002<\/p>\n<p><strong>[ble_lcd.py]<\/strong><\/p>\n<pre class=\"brush: cpp; title: Code-Example; notranslate\" title=\"Code-Example\">#!\/usr\/bin\/env python3\r\n# coding: utf-8\r\n\r\nimport dothat.lcd as lcd\r\n\r\nfrom datetime import datetime\r\nfrom bluepy import btle\r\nfrom sys import argv\r\nimport getpass\r\nfrom time import sleep\r\n\r\ndef payval(num, bytes=1, sign=False):\r\n    global val\r\n    a = 0\r\n    for i in range(0, bytes):\r\n        a += (256 ** i) * int(val[(num - 2 + i) * 2 : (num - 1 + i) * 2],16)\r\n    if sign:\r\n        if a &gt;= 2 ** (bytes * 8 - 1):\r\n            a -= 2 ** (bytes * 8)\r\n    return a\r\n\r\nimport RPi.GPIO as GPIO\r\nhuman_pin = 13\r\nGPIO.setmode(GPIO.BCM)\r\nGPIO.setup(human_pin, GPIO.IN)\r\nhuman_count = 0\r\nhuman_check = 3\r\n\r\ninterval = 10 # \u5de5\u4f5c\u95f4\u9694\r\nscanner = btle.Scanner()\r\n\r\nwhile True:\r\n  \r\n    now = datetime.now()\r\n    d = '{0:0&gt;4d}\/{1:0&gt;2d}\/{2:0&gt;2d}({3})'.format(now.year, now.month, now.day, now.strftime('%a'))\r\n    t = '{0:0&gt;2d}:{1:0&gt;2d}:{2:0&gt;2d}'.format(now.hour, now.minute, now.second)\r\n    lcd.clear()\r\n    lcd.set_cursor_position(0, 0)\r\n    lcd.write('PiRemote')\r\n    lcd.set_cursor_position(0, 1)\r\n    lcd.write('{}'.format(d))\r\n    lcd.set_cursor_position(2, 2)\r\n    lcd.write('{}'.format(t))\r\n\r\n    human = GPIO.input(human_pin)\r\n    print(human)\r\n    if human == 1:\r\n      human_count+=1\r\n    else:\r\n      human_count=0\r\n    \r\n    try:\r\n        devices = scanner.scan(interval)\r\n    except Exception as e:\r\n        print(\"ERROR\",e)\r\n        if getpass.getuser() != 'root':\r\n            print('\u4f7f\u7528\u65b9\u6cd5: sudo', argv[0])\r\n            exit()\r\n        sleep(interval)\r\n        continue\r\n\r\n    for dev in devices:\r\n        print(\"\\nDevice %s (%s), RSSI=%d dB\" % (dev.addr, dev.addrType, dev.rssi))\r\n        isRohmMedal = False\r\n        sensors = dict()\r\n        for (adtype, desc, val) in dev.getScanData():\r\n            print(\"  %s = %s\" % (desc, val))\r\n            if desc == 'Short Local Name' and val[0:10] == '极悦娱乐Medal2':\r\n                isRohmMedal = True\r\n            if isRohmMedal and desc == 'Manufacturer':\r\n\r\n                sensors['ID'] = hex(payval(2,2))\r\n                sensors['Temperature'] = -45 + 175 * payval(4,2) \/ 65536\r\n                sensors['Humidity'] = 100 * payval(6,2) \/ 65536\r\n                sensors['Illuminance'] = payval(25,2) \/ 1.2\r\n                sensors['Battery Level'] = payval(30)\r\n                sensors['RSSI'] = dev.rssi\r\n\r\n                print('    ID            =',sensors['ID'])\r\n                print('    Temperature   =',round(sensors['Temperature'],2),'\u2103')\r\n                print('    Humidity      =',round(sensors['Humidity'],2),'%')\r\n                print('    Illuminance   =',round(sensors['Illuminance'],1),'lx')\r\n                print('    Battery Level =',sensors['Battery Level'],'%')\r\n                print('    RSSI          =',sensors['RSSI'],'dB')\r\n\r\n                '''\r\n                for key, value in sorted(sensors.items(), key=lambda x:x[0]):\r\n                    print('    ',key,'=',value)\r\n                '''\r\n\r\n                temp  = sensors['Temperature']\r\n                humid = sensors['Humidity']\r\n                if temp &gt; 26 or humid &gt; 60:\r\n                    temp_msg = \"Hot!\"\r\n                else:\r\n                    temp_msg = \"Not bad\"\r\n\r\n                illum = sensors['Illuminance']\r\n                if illum &lt; 200:\r\n                    illum_msg = \"Dark!\"\r\n                else:\r\n                    illum_msg = \"Bright\"\r\n\r\n                if human_count &gt; human_check:\r\n                    human_msg = \"Take Rest\"\r\n                else:\r\n                    human_msg = \"Work Hard!\"\r\n\r\n                lcd.clear()\r\n                lcd.set_cursor_position(0, 0)\r\n                lcd.write('Temp: {0:1.0f}C {1:1.0f}% {2}'.format(temp, humid, temp_msg))\r\n                lcd.set_cursor_position(0, 1)\r\n                lcd.write('Illum: {0:1.0f}Lx {1}'.format(illum,illum_msg))\r\n                lcd.set_cursor_position(0, 2)\r\n                lcd.write('{0:1.0f} Cnt {1}'.format(human_count, human_msg))\r\n\r\n                sleep(interval)\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5982\u679c\u60a8\u50cf\u201csudo python3 ble_lcd.py\u201d\u4e00\u6837\u8fd0\u884c\u8fd9\u4e2a\u7a0b\u5e8f\uff0c\u90a3\u4e48\u5c06\u4f1a\u9996\u5148\u83b7\u53d6\u5e76\u663e\u793a\u5f53\u524d\u7684\u65e5\u671f\u548c\u65f6\u95f4\u7b49\u4fe1\u606f\u3002<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-12.jpg\" rel=\"attachment wp-att-26541\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26541\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-12.jpg\" alt=\"raspberrypi-comfortable-space-device-03-12\" width=\"600\" height=\"347\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u5373\u53ef\u901a\u8fc7BLE\u83b7\u5f97SensorMedal\u7684\u6d4b\u91cf\u503c\u3002\u7136\u540e\u5c06\u4f1a\u663e\u793a\u6e29\u5ea6\u3001\u6e7f\u5ea6\u548c\u4eae\u5ea6\u7b49\u4fe1\u606f\u3002\u901a\u8fc7\u4eba\u4f53\u4f20\u611f\u5668\uff0c\u60a8\u8fd8\u53ef\u4ee5\u67e5\u770b\u4eba\u5728\u90a3\u91cc\u5446\u4e86\u591a\u5c11\u79d2\u3002<\/p>\n<p><a href=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-13.jpg\" rel=\"attachment wp-att-26542\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26542\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-comfortable-space-device-03-13.jpg\" alt=\"raspberrypi-comfortable-space-device-03-13\" width=\"600\" height=\"347\" \/><\/a><\/p>\n<p>\u5982\u679c\u5ba4\u6e29\u9ad8\u4e8e26\u2103\u3001\u6e7f\u5ea6\u9ad8\u4e8e 60%\uff0c\u5b83\u4f1a\u53d1\u51fa\u8b66\u544a\u3002\u53e6\u5916\uff0c\u5728\u4eae\u5ea6\u4e3a200Lx\u4ee5\u4e0b\u65f6\uff0c\u663e\u793a\u6d88\u606f\u4e5f\u4f1a\u53d1\u751f\u53d8\u5316\u3002<br \/>\n\u800c\u5f53\u4eba\u4f53\u4f20\u611f\u5668\u68c0\u6d4b\u5230\u4eba\u5728\u90a3\u91cc\u7684\u505c\u7559\u65f6\u95f4\u8d85\u8fc7\u4e00\u5b9a\u65f6\u95f4\u65f6\uff08\u4e3a\u4fbf\u4e8e\u6d4b\u8bd5\uff0c\u8fd9\u91cc\u8bbe\u7f6e\u4e3a30\u79d2\u5de6\u53f3\uff09\uff0c\u663e\u793a\u4fe1\u606f\u5c31\u4f1a\u53d8\u4e3a\u201c\u8be5\u4f11\u606f\u4e86\uff01\u201d<\/p>\n<p>\u60a8\u53ef\u4ee5\u6839\u636e\u623f\u95f4\u60c5\u51b5\u548c\u5de5\u4f5c\u60c5\u51b5\u5c1d\u8bd5\u66f4\u6539\u6bcf\u79cd\u4f20\u611f\u5668\u7684\u9608\u503c\u3002\u6839\u636e\u756a\u8304\u5de5\u4f5c\u6cd5\uff0c\u91c7\u7528\u5de5\u4f5c25\u5206\u949f\u4f11\u606f5\u5206\u949f\u7684\u65f6\u95f4\u5b89\u6392\uff0c\u5de5\u4f5c\u6548\u7387\u4f1a\u6bd4\u8f83\u597d\uff0c\u60a8\u4e5f\u53ef\u4ee5\u6839\u636e\u8fd9\u7c7b\u65b9\u6cd5\u6765\u8bbe\u7f6e\u6570\u503c\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>3. \u603b\u7ed3<\/h2>\n<p>\u8fd9\u6b21\u6211\u4eec\u5728SensorMedal\u57fa\u7840\u4e0a\u53c8\u6dfb\u52a0\u4e86\u4e00\u4e2a\u4eba\u4f53\u4f20\u611f\u5668\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u68c0\u6d4b\u684c\u5b50\u5468\u56f4\u662f\u5426\u6709\u4eba\u4e86\u3002\u5728\u6211\u4eec\u5728\u5bb6\u529e\u516c\u8fc7\u7a0b\u4e2d\uff0c\u5f88\u5bb9\u6613\u5750\u7684\u65f6\u95f4\u8fc7\u957f\uff0c\u62e5\u6709\u4e00\u4e2a\u80fd\u591f\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u5173\u5fc3\u6211\u4eec\u3001\u63d0\u9192\u6211\u4eec\u7684\u8bbe\u5907\uff0c\u771f\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u6211\u4eec\u8fd8\u6dfb\u52a0\u4e86\u4e00\u4e2a\u6db2\u6676\u663e\u793a\u5668\uff0c\u7528\u6765\u663e\u793a\u6765\u81ea\u4f20\u611f\u5668\u7684\u503c\u3002\u5982\u679c\u662fHAT\u578b\u663e\u793a\u5668\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u73b0\u6709\u7684\u5e93\u6587\u4ef6\u8f7b\u677e\u5b9e\u73b0\u6570\u636e\u663e\u793a\u3002\u5f53\u7136\uff0c\u60a8\u4e5f\u53ef\u4ee5\u81ea\u5df1\u8fde\u63a5\u6db2\u6676\u663e\u793a\u5668\u5e76\u81ea\u5df1\u5c1d\u8bd5\u4f7f\u7528\u3002<\/p>\n<p>\u5728<a href=\"https:\/\/deviceplus.jp\/hobby\/raspberrypi-comfortable-space-device-04\/\">\u7b2c\u56db\u90e8\u5206<\/a>\uff0c\u6211\u4eec\u5c06\u4f1a\u5c1d\u8bd5\u5b9e\u73b0\u80fd\u591f\u4ece\u4e92\u8054\u7f51\u83b7\u53d6\u4fe1\u606f\u3001\u5e76\u901a\u8fc7\u5404\u79cd\u6570\u503c\u63d0\u9192\u4e3b\u4eba\u884c\u52a8\u7684\u673a\u5236\uff0c\u5e76\u6700\u7ec8\u5b8c\u6210\u6574\u4e2a\u8212\u9002\u73af\u5883\u8425\u9020\u8bbe\u5907\u3002<br \/>\n\u656c\u8bf7\u671f\u5f85\uff01<\/p>\n<div class=\"author-box-wrapper\">\n<div class=\"avatar-wrapper\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/k.yoshida_avatar.jpg\" alt=\"\u5409\u7530\u3000\u663e\u4e00\uff08Yoshiken\uff09\" width=\"64\" height=\"64\" \/><\/div>\n<div class=\"desc-wrapper\">\n<h5>\u5409\u7530\u3000\u663e\u4e00\uff08Yoshiken\uff09<\/h5>\n<div class=\"desc\">\u5728\u666e\u901a\u516c\u53f8\u5de5\u4f5c\u7684\u4e0a\u73ed\u65cf\uff0c\u975e\u5e38\u559c\u6b22\u521b\u4f5c\u7684\u5468\u672b\u521b\u5ba2\uff0c\u51fa\u7248\u4e86\u7535\u5b50\u4e66MESHBOOK\uff0c\u5e73\u65f6\u4e5f\u5199\u5199\u535a\u5ba2\u3002<br \/>\nhttp:\/\/blog.ktrips.net<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u5927\u5bb6\u597d\uff0c\u6211\u662f\u5409\u7530\uff01 \u6211\u4eec\u8fd9\u6b21\u8981\u521b\u4f5c\u4e00\u6b3e\u8ba9\u5bb6\u4e2d\u66f4\u8212\u9002\u3001\u8ba9\u5728\u5bb6\u529e\u516c\u66f4\u9ad8\u6548\u7684\u8bbe\u5907\uff0c\u672c\u6587\u662f\u7b2c\u4e09\u90e8\u5206\u3002 \u5728\u7b2c\u4e8c\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u7528BLE\u8fde\u63a5\u4e86\u7f57\u59c6SensorMedal\u5e76\u6d4b\u91cf\u4e86\u5404\u79cd\u6570\u636e\u3002\u5728\u7b2c\u4e09\u90e8\u5206\uff0c\u6211\u5e0c\u671b\u901a\u8fc7\u5b89\u88c5\u4eba\u4f53\u4f20\u611f\u5668\u7b49\u5668\u4ef6\uff0c\u5b9e\u73b0\u68c0 [&hellip;]","protected":false},"author":4,"featured_media":21136,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1132],"tags":[],"class_list":["post-21082","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\/21082","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\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/comments?post=21082"}],"version-history":[{"count":11,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/21082\/revisions"}],"predecessor-version":[{"id":29645,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/21082\/revisions\/29645"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media\/21136"}],"wp:attachment":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media?parent=21082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/categories?post=21082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/tags?post=21082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}