{"id":21304,"date":"2022-10-27T00:00:47","date_gmt":"2022-10-26T16:00:47","guid":{"rendered":"https:\/\/techclass.wfjydl.com\/?p=21304"},"modified":"2026-04-30T16:14:43","modified_gmt":"2026-04-30T08:14:43","slug":"%e4%b8%80%e6%ac%be%e7%94%a8raspberry-pi%e5%92%8c%e4%bc%a0%e6%84%9f%e5%99%a8%e5%88%b6%e4%bd%9c%e7%9a%84%e5%8f%af%e7%a9%bf%e6%88%b4%e5%bc%8f%e5%b0%8f%e5%9e%8b%e5%81%a5%e5%ba%b7%e7%ae%a1%e7%90%86-3","status":"publish","type":"post","link":"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-wearable-healthcare-device-03\/","title":{"rendered":"\u4e00\u6b3e\u7528Raspberry Pi\u548c\u4f20\u611f\u5668\u5236\u4f5c\u7684\u53ef\u7a7f\u6234\u5f0f\u5c0f\u578b\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\uff01\u7b2c\u4e09\u90e8\u5206"},"content":{"rendered":"<p>\u7b2c1\u90e8\u5206\uff1a<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-wearable-healthcare-device-01\/\">\u7528Raspberry Pi Zero\u548c\u7f57\u59c6SensorMedal\u5236\u4f5c\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\uff01<\/a><br \/>\n\u7b2c2\u90e8\u5206\uff1a<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-wearable-healthcare-device-02\/\">\u6839\u636e\u4f20\u611f\u5668\u7684\u503c\u8ba1\u7b97\u6b65\u6570\u3001\u8ddd\u79bb\u548c\u5361\u8def\u91cc\uff0c\u5e76\u5c06\u6570\u636e\u53d1\u9001\u5230LINE\uff01<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u5409\u7530\uff01<\/p>\n<p>\u672c\u6587\u662f\u5236\u4f5c\u65e8\u5728\u89e3\u51b3\u8fd0\u52a8\u4e0d\u8db3\u95ee\u9898\u7684\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\u9879\u76ee\u7684\u7b2c\u4e09\u90e8\u5206\u3002\u8fd9\u6b21\u6211\u4eec\u5c06\u4f7f\u7528\u8109\u640f\u4f20\u611f\u5668\u6765\u6d4b\u91cf\u5fc3\u7387\u5e76\u5c06\u6d4b\u91cf\u6570\u636e\u7528\u4e8e\u5065\u5eb7\u7ba1\u7406\u3002<\/p>\n<p>\u7531\u4e8e\u6d4b\u91cf\u751f\u7269\u4fe1\u606f\u975e\u5e38\u5bb9\u6613\uff0c\u56e0\u6b64\u53ef\u4ee5\u8ba9\u8fd9\u4e9b\u4fe1\u606f\u6709\u5f88\u591a\u7528\u5904\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26692\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_01.jpg\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_01.jpg 745w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_01.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_01\" width=\"745\" height=\"340\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u672c\u90e8\u5206\u6240\u9700\u90e8\u4ef6<\/h2>\n<h3><a href=\"https:\/\/amzn.to\/39FN1Nr\" target=\"_blank\" rel=\"noopener\">Raspberry Pi Zero W<\/a><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26693\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_02-1.jpg\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_02-1.jpg 422w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_02-1.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_02\" width=\"422\" height=\"268\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><a href=\"https:\/\/www.sengoku.co.jp\/mod\/sgk_cart\/detail.php?code=EEHD-4JT4\" target=\"_blank\" rel=\"noopener\">\u5fc3\u7387\u4f20\u611f\u5668<\/a><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26694\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_03-1.jpg\" sizes=\"auto, (max-width: 388px) 100vw, 388px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_03-1.jpg 388w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_03-1.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_03\" width=\"388\" height=\"292\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><a href=\"https:\/\/www.switch-science.com\/catalog\/5292\/\" target=\"_blank\" rel=\"noopener\">NeoPixel LED\u706f\u5e26<\/a><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26695\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_04.jpg\" sizes=\"auto, (max-width: 358px) 100vw, 358px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_04.jpg 358w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_04.jpg 150w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_04.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_04\" width=\"358\" height=\"358\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u672c\u90e8\u5206\u7684\u6d41\u7a0b<\/h2>\n<ol>\n<li><a href=\"#01\">\u8109\u640f\u4f20\u611f\u5668\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5<\/a><\/li>\n<li><a href=\"#02\">\u6839\u636e\u5fc3\u7387\u548c\u6d3b\u52a8\u91cf\u70b9\u4eaeLED\u706f<\/a><\/li>\n<li><a href=\"#03\">\u8ba9SensorMedal\u4e5f\u540c\u65f6\u8fd0\u884c<\/a><\/li>\n<li><a href=\"#04\">\u603b\u7ed3<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2 id=\"01\">1. \u8109\u640f\u4f20\u611f\u5668\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<p>\u8fd9\u6b21\u6211\u51b3\u5b9a\u4f7f\u7528\u8109\u640f\u4f20\u611f\u5668\u6765\u6d4b\u91cf\u8fd0\u52a8\u65f6\u7684\u5fc3\u7387\u3002\u8109\u640f\u4f20\u611f\u5668\u662f\u7528\u6765\u6d4b\u91cf\u968f\u7740\u5fc3\u810f\u8df3\u52a8\u548c\u6cf5\u8840\u800c\u589e\u52a0\u6216\u51cf\u5c11\u7684\u8840\u7ba1\u4f53\u79ef\u53d8\u5316\u7684\u8bbe\u5907\u3002\u8fd9\u79cd\u4f20\u611f\u5668\u914d\u6709LED\u548c\u6570\u636e\u63a5\u6536IC\uff0c\u901a\u8fc7\u4f7fLED\u5149\u7167\u6307\u5c16\uff0c\u53ef\u4ee5\u68c0\u6d4b\u4ece\u8840\u7ba1\u8fd4\u56de\u7684\u5149\u7ebf\u60c5\u51b5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26696\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_05.png\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_05.png 745w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_05.png 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_05\" width=\"745\" height=\"340\" \/><\/p>\n<p>\u9996\u5148\uff0c\u9700\u8981\u51c6\u5907\u8109\u640f\u4f20\u611f\u5668\u548c Raspberry Pi Zero\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26697\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_06.jpg\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_06.jpg 745w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_06.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_06\" width=\"745\" height=\"370\" \/><\/p>\n<p>&nbsp;<\/p>\n<p> \u8fd9\u4e2a\u8109\u640f\u4f20\u611f\u5668\u4e0eRaspberry Pi\u7b49\u76f8\u8fde\u63a5\u7684\u5f15\u811a\u662fGrove\u5f15\u811a\uff08\u56db\u4e2a\u8fde\u63a5\u5f15\u811a\u7ec4\u5408\u5728\u4e00\u8d77\u7684\u5f15\u811a\uff09\u3002\u6839\u636e\u7ebf\u7f06\u989c\u8272\u5206\u522b\u4e0eRaspberry Pi\u7684GND\uff08\u9ed1\u8272\uff09\u548c3.3V\u7535\u6e90\uff08\u7ea2\u8272\uff09\u8fde\u63a5\u3002\u4f5c\u4e3aGPIO\uff0c\u5c06\u9ec4\u8272\u5f15\u811a\u90e8\u5206\u4e0eGPIO12\u76f8\u8fde\u63a5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26698\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_07.jpg\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_07.jpg 500w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_07.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_07\" width=\"500\" height=\"457\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u73b0\u5728\u8ba9\u6211\u4eec\u7f16\u5199\u4e00\u4e2a\u7a0b\u5e8f\u6765\u4f7f\u8fd9\u4e2a\u8109\u640f\u4f20\u611f\u5668\u5de5\u4f5c\u3002\u5f53heart.py\u80fd\u50cf\u4e0b\u9762\u8fd9\u6837\u83b7\u5f9720\u79d2\u7684\u5fc3\u7387\u65f6\uff0c\u8868\u660e\u5df2\u7ecf\u80fd\u591f\u5f00\u59cb\u6d4b\u91cf\u3002<\/p>\n<pre class=\"brush: cpp; title: Code-Example; notranslate\" title=\"Code-Example\">pi@raspizero:~\/Programs $ sudo vi heart.py\r\n\r\n---\r\n\r\n#!\/usr\/bin\/env python\r\nimport time\r\nfrom collections import deque\r\n\r\nimport RPi.GPIO as GPIO\r\n\r\nclass HeartRateMonitor:\r\n    INTERRUPT_PIN = 12\r\n    MAX_DETECTED_TIMES_COUNT = 20\r\n    MAX_PULSE_INTERVAL = 2.0\r\n\r\n    def __init__(self):\r\n        GPIO.setmode(GPIO.BCM)\r\n        GPIO.setup(self.INTERRUPT_PIN, GPIO.IN)\r\n\r\n        self._init_array()\r\n\r\n    def _init_array(self):\r\n        self.detected_times = deque([])\r\n\r\n    def _calc_heart_rate(self):\r\n        return 1200.0 \/ (self.detected_times[-1] - self.detected_times[0])\r\n\r\n    def _interrupt(self):\r\n        self.detected_times.append(time.time())\r\n\r\n        if(len(self.detected_times) == 1):\r\n            return\r\n\r\n        interval = self.detected_times[-1] - self.detected_times[-2]\r\n        heart_rate = -1\r\n        if interval &gt; self.MAX_PULSE_INTERVAL:\r\n            print('Heart rate measure error. Monitoring will restart!')\r\n            self._init_array()\r\n            return\r\n\r\n        if(len(self.detected_times) &gt;= self.MAX_DETECTED_TIMES_COUNT):\r\n            heart_rate = self._calc_heart_rate()\r\n            self.detected_times.popleft()\r\n\r\n        print(\"HeartRate: {heart_rate}, Interval: {interval}\".format(heart_rate = heart_rate, interval = interval))\r\n\r\n    def execute(self):\r\n        print('Please ready your heart rate monitor.')\r\n        time.sleep(3)\r\n\r\n        while True:\r\n            GPIO.wait_for_edge(self.INTERRUPT_PIN, GPIO.RISING)\r\n            self._interrupt()\r\n\r\nif __name__ == '__main__':\r\n    monitor = HeartRateMonitor()\r\n    monitor.execute()\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u7528\u5939\u5b50\u5939\u4f4f\u6307\u5c16\uff0c\u6d4b\u91cf\u4e00\u4e0b\u5fc3\u7387\u5427\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26699\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_08.jpg\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_08.jpg 500w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_08.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_08\" width=\"500\" height=\"378\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u8fd0\u884c\u7a0b\u5e8f\u5e76\u786e\u8ba4\u662f\u5426\u53ef\u4ee5\u51c6\u786e\u6d4b\u91cf20\u79d2\u5de6\u53f3\u7684\u5fc3\u7387\uff0c\u786e\u8ba4\u53ef\u4ee5\u540e\uff0c\u5373\u53ef\u663e\u793a59 BPS\uff08\u6bcf\u79d2\u5fc3\u7387\uff09\u621660 BPS\u7b49\u6570\u636e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26700\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_09.png\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_09.png 549w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_09.png 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_09\" width=\"549\" height=\"492\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"02\">2. \u6839\u636e\u5fc3\u7387\u548c\u6d3b\u52a8\u91cf\u70b9\u4eaeLED\u706f<\/h2>\n<p>\u786e\u8ba4\u80fd\u591f\u6d4b\u91cf\u5fc3\u7387\u540e\uff0c\u6211\u4eec\u9700\u8981\u8fde\u63a5LED\u5e76\u7528\u5149\u7684\u989c\u8272\u6765\u663e\u793a\u76f8\u5e94\u7684\u6d4b\u91cf\u7ed3\u679c\u3002\u5982\u679c\u5fc3\u7387\u8fc7\u5feb\uff0c\u53ef\u80fd\u4f1a\u6536\u5230\u8b66\u62a5\u3002<\/p>\n<p>\u8fd9\u4e00\u6b21\uff0c\u6211\u5c06\u4f7f\u7528\u540d\u4e3a\u201cNeoPixel\u201d\u7684\u5f69\u8272LED\u706f\u5e26\u3002\u8fd9\u662f\u4e00\u79cd\u63a5\u6709\u591a\u4e2aLED\u7684\u5e26\u72b6\u706f\uff0c\u60a8\u53ef\u4ee5\u5c06\u5176\u5207\u5272\u6210\u4efb\u4f55\u60a8\u559c\u6b22\u7684\u5c3a\u5bf8\u6765\u4f7f\u7528\u3002\u8fd9\u6b21\u6211\u6839\u636eRaspberry Pi Zero\u7684\u5927\u5c0f\u5207\u5272\u6210\u4e86\u5177\u67093\u4e2aLED\u7684\u706f\u5e26\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26701\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_10.jpg\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_10.jpg 500w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_10.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_10\" width=\"500\" height=\"198\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u8fd9\u79cd\u5e26\u72b6LED\u706f\u5177\u6709+5V\u3001Din\u548cGND\u5f15\u811a\uff0c\u5206\u522b\u4e0eRaspberry Pi\u76845V\u3001GPIO21\u548cGND\u8fde\u63a5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26702\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_11.jpg\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_11.jpg 500w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_11.jpg 286w\" alt=\"raspberrypi-wearable-healthcare-device-03_11\" width=\"500\" height=\"525\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u6709\u5173\u5982\u4f55\u4f7f\u7528NeoPixel\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u53ef\u4ee5\u53c2\u9605\u4e0b\u9762\u7684Adafruit\u9875\u9762\uff0c\u5e76\u53ef\u4ee5\u4ece\u4e2d\u83b7\u53d6\u4ee5\u4e0b\u5e93\u548c\u793a\u4f8b\u7a0b\u5e8f\u3002<\/p>\n<p><a href=\"https:\/\/learn.adafruit.com\/adafruit-neopixel-uberguide\/python-circuitpython\" target=\"_blank\" rel=\"noopener\">\u4e0b\u8f7d\u5e93\u548c\u793a\u4f8b\u7a0b\u5e8f<\/a><\/p>\n<p>\u5728\u793a\u4f8b\u7a0b\u5e8f\u4e2d\uff0c\u7531\u4e8e\u4e0eGPIO21\u8fde\u63a5\u800c\u8bbe\u7f6e\u4e3a\u201cpixel_pin = board.D21\u201d\uff0c\u7531\u4e8eLED\u7684\u6570\u91cf\u4e3a3\u800c\u8bbe\u7f6e\u4e3a\u201cnum_pixels = 3\u201d\u3002<\/p>\n<pre class=\"brush: cpp; title: Code-Example; notranslate\" title=\"Code-Example\">pi@raspizero:~\/ $ sudo pip3 install adafruit-circuitpython-neopixel\r\npi@raspizero:~\/ $ sudo wget https:\/\/learn.adafruit.com\/pages\/10683\/elements\/3005652\/download -O neopixels.py\r\npi@raspizero:~\/ $ sudo python3 neopixels.py\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8fd0\u884c\u8be5\u793a\u4f8b\u7a0b\u5e8f\uff0cLED\u53d1\u51fa\u4e03\u79cd\u989c\u8272\u7684\u5149\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26703\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_12.jpg\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_12.jpg 745w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_12.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_12\" width=\"745\" height=\"380\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u4e3a\u4e86\u4f7fLED\u4e0e\u5fc3\u7387\u8054\u52a8\uff0c\u6211\u4eec\u5728\u524d\u9762\u7684heart.py\u7a0b\u5e8f\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u63cf\u8ff0\uff0c\u521b\u5efaheart_pixels.py\u7a0b\u5e8f\u3002\u4e0b\u9762\u7684\u9ec4\u8272\u90e8\u5206\u662f\u5728\u539f\u6765\u7684heart.py\u7a0b\u5e8f\u4e2d\u6dfb\u52a0NeoPixel\u4ee3\u7801\u7684\u90e8\u5206\u3002<\/p>\n<pre class=\"brush: cpp; title: Code-Example; notranslate\" title=\"Code-Example\">#!\/usr\/bin\/env python\r\n#coding: utf-8\r\n\r\nimport board\r\nimport neopixel\r\n\r\npixel_pin = board.D21\r\nnum_pixels = 3\r\nORDER = neopixel.GRB\r\npixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False,\r\n                                   pixel_order=ORDER)\r\nnormal_rate= 60\r\nhigh_rate  = 100\r\n\r\nimport time\r\nfrom collections import deque\r\n\u2026\r\n\r\n        print(\"HeartRate: {heart_rate}, Interval: {interval}\".format(heart_rate = heart_rate, interval = interval))\r\n        if heart_rate &gt; high_rate:\r\n            pixels.fill((255,0,0))\r\n            pixels.show()\r\n            time.sleep(0.1)\r\n        elif heart_rate &gt; normal_rate:\r\n            pixels.fill((0,255,0))\r\n            pixels.show()\r\n            time.sleep(0.5)\r\n        elif heart_rate &gt; 0:\r\n            pixels.fill((0,0,255))\r\n            pixels.show()\r\n            time.sleep(0.5)\r\n        else:\r\n            pixels.fill((255,255,255))\r\n            pixels.show()\r\n        pixels.fill((0,0,0))\r\n        pixels.show()\r\n\r\n    def execute(self):\r\n...\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5f53heart_pixels.py\u8fd9\u4e2a\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0cLED\u5148\u662f\u767d\u8272\u5149\u95ea\u70c1\uff0c\u5f53\u5fc3\u7387\u8d85\u8fc7\u4e00\u5b9a\u6c34\u5e73\uff08\u8fd9\u91cc\u8bbe\u7f6e\u4e3a100\uff09\u65f6\uff0c\u4f1a\u53d1\u51fa\u7ea2\u8272\u5149\u5e76\u53d1\u51fa\u8b66\u62a5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26704\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_13.png\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_13.png 550w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_13.png 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_13\" width=\"550\" height=\"238\" \/><\/p>\n<p>\u5982\u679c\u5fc3\u7387\u572860\u4ee5\u4e0a100\u4ee5\u4e0b\uff0c\u7eff\u8272\u706f\u95ea\u70c1\u3002\u5982\u679c\u5fc3\u7387\u8d85\u8fc7100\uff0c\u5219\u4f1a\u53d1\u51fa\u7ea2\u8272\u5149\u548c\u8b66\u62a5\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"03\">3. \u8ba9SensorMedal\u4e5f\u540c\u65f6\u8fd0\u884c<\/h2>\n<p>\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u5c1d\u8bd5\u8ba9SensorMedal\u4e5f\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u3002<\/p>\n<p>\u4e3a\u6b64\uff0c\u9700\u8981\u521b\u5efa\u5982\u4e0b\u6240\u793a\u7684shell\u811a\u672c (ble_steps_heart.sh)\u3002nohup\u548c&#038;\u4e4b\u95f4\u7684\u90e8\u5206\u5c06\u5728\u540e\u53f0\u8fd0\u884c\u3002<\/p>\n<pre class=\"brush: cpp; title: Code-Example; notranslate\" title=\"Code-Example\">#!\/bin\/bash\r\nnohup sudo python3 \/home\/pi\/Programs\/heart_pixels.py &amp;\r\nsudo python3 \/home\/pi\/Programs\/ble_steps_line.py\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4e0b\u9762\uff0c\u50cf\u201c.ble_steps_heart.sh\u201d\u4e00\u6837\u8fd0\u884c\u7a0b\u5e8f\uff0c\u5373\u53ef\u6d4b\u91cf\u4e24\u8005\u7684\u503c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26706\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_15.png\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_15.png 550w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_15.png 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_15\" width=\"550\" height=\"292\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>LED\u706f\u5e26\u4f1a\u6839\u636e\u5fc3\u7387\u503c\u53d1\u5149\uff0cSensorMedal\u7684\u6570\u503c\u8fd8\u53ef\u4ee5\u4e0a\u4f20\u5230LINE\u7b49\u7cfb\u7edf\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2022\/10\/raspberrypi-wearable-healthcare-device-03_16.jpg\" alt=\"raspberrypi-wearable-healthcare-device-03_16\" width=\"522\" height=\"344\" class=\"alignnone size-full wp-image-21342\" \/><\/p>\n<p>&nbsp;<\/p>\n<p> \u5c06\u5176\u505a\u6210\u624b\u8868\u5f0f\u8bbe\u5907\uff0c\u5c06\u8109\u640f\u4f20\u611f\u5668\u6234\u5728\u624b\u6307\u4e0a\u5e76\u62ff\u7740SensorMedal\uff0c\u5373\u53ef\u5e2e\u52a9\u60a8\u8fdb\u884c\u4e00\u5929\u7684\u5065\u5eb7\u7ba1\u7406\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26708\" src=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_17.jpg\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" srcset=\"https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_17.jpg 750w, https:\/\/techclass.wfjydl.com\/wp-content\/uploads\/2026\/04\/raspberrypi-wearable-healthcare-device-03_17.jpg 300w\" alt=\"raspberrypi-wearable-healthcare-device-03_17\" width=\"750\" height=\"487\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"04\">4. \u603b\u7ed3<\/h2>\n<p>\u5728\u8fd9\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c1d\u8bd5\u4e86\u4f7f\u7528\u8109\u640f\u4f20\u611f\u5668\u6765\u6d4b\u91cf\u65e5\u5e38\u751f\u6d3b\u4e2d\u7684\u8109\u640f\u548c\u5fc3\u7387\u3002\u901a\u8fc7\u8fd9\u90e8\u5206\u7684\u4ecb\u7ecd\uff0c\u6211\u60f3\u60a8\u5e94\u8be5\u5df2\u7ecf\u53ef\u4ee5\u4f7f\u7528Raspberry Pi\u8f7b\u677e\u83b7\u53d6\u751f\u7269\u4fe1\u606f\u5e76\u8fdb\u884c\u67e5\u770b\u4e86\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u5728\u8fd9\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u8fd8\u4e86\u89e3\u4e86\u53ef\u4ee5\u540c\u65f6\u8fd0\u884cSensorMedal\u5e76\u4e0a\u4f20\u5176\u6d4b\u91cf\u7ed3\u679c\u3002\u80fd\u591f\u6d4b\u91cf\u6b65\u6570\u548c\u5fc3\u7387\uff0c\u8fd9\u4e2a\u4f5c\u54c1\u5df2\u7ecf\u8d8a\u6765\u8d8a\u50cf\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\u4e86\u3002<\/p>\n<p>\u5728<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-wearable-healthcare-device-04\/\">\u4e0b\u4e00\u90e8\u5206<\/a>\u4e2d\uff0c\u6211\u60f3\u628a\u73b0\u6709\u7684\u8ba1\u6b65\u5668\u548c\u5fc3\u7387\u76d1\u6d4b\u4eea\u529f\u80fd\u7ed3\u5408\u8d77\u6765\uff0c\u5b8c\u6210\u66f4\u8fd9\u6b3e\u50cf\u53ef\u7a7f\u6234\u8bbe\u5907\u7684\u4f5c\u54c1\u3002<\/p>\n<p>\u656c\u8bf7\u671f\u5f85\uff01<\/p>\n<div class=\"product_link_box\">\n<span style=\"font-size: 12pt;\"><strong>\u76f8\u5173\u8fde\u8f7d\u4e00\u89c8<\/strong><\/span><\/p>\n<p>\u7b2c1\u90e8\u5206\uff1a<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-wearable-healthcare-device-01\/\">\u7528Raspberry Pi Zero\u548c\u7f57\u59c6SensorMedal\u5236\u4f5c\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\uff01<\/a><br \/>\n\u7b2c2\u90e8\u5206\uff1a<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-wearable-healthcare-device-02\/\">\u6839\u636e\u4f20\u611f\u5668\u7684\u503c\u8ba1\u7b97\u6b65\u6570\u3001\u8ddd\u79bb\u548c\u5361\u8def\u91cc\uff0c\u5e76\u5c06\u6570\u636e\u53d1\u9001\u5230LINE\uff01<\/a><br \/>\n\u7b2c3\u90e8\u5206\uff1a\u4e00\u6b3e\u7528Raspberry Pi\u548c\u4f20\u611f\u5668\u5236\u4f5c\u7684\u53ef\u7a7f\u6234\u5f0f\u5c0f\u578b\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\uff01\uff08\u672c\u7ae0\uff09<br \/>\n\u7b2c4\u90e8\u5206\uff1a<a href=\"https:\/\/techclass.wfjydl.com\/knowledge\/tech-info\/raspberry\/raspberrypi-wearable-healthcare-device-04\/\">\u8fde\u63a5\u663e\u793a\u5668\u5e76\u5b8c\u6210\u8fd9\u6b3e\u53ef\u7a7f\u6234\u5f0f\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\uff01<\/a>\n<\/div>\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\">\n<p>\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\n<\/p><\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u7b2c1\u90e8\u5206\uff1a\u7528Raspberry Pi Zero\u548c\u7f57\u59c6SensorMedal\u5236\u4f5c\u5065\u5eb7\u7ba1\u7406\u8bbe\u5907\uff01 \u7b2c2\u90e8\u5206\uff1a\u6839\u636e\u4f20\u611f\u5668\u7684\u503c\u8ba1\u7b97\u6b65\u6570\u3001\u8ddd\u79bb\u548c\u5361\u8def\u91cc\uff0c\u5e76\u5c06\u6570\u636e\u53d1\u9001\u5230LINE\uff01 &nbsp; \u5927\u5bb6\u597d\uff0c\u6211\u662f\u5409\u7530\uff01 \u672c\u6587\u662f\u5236\u4f5c\u65e8\u5728\u89e3\u51b3 [&hellip;]","protected":false},"author":4,"featured_media":21329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1132],"tags":[],"class_list":["post-21304","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\/21304","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=21304"}],"version-history":[{"count":9,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/21304\/revisions"}],"predecessor-version":[{"id":29757,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/posts\/21304\/revisions\/29757"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media\/21329"}],"wp:attachment":[{"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/media?parent=21304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/categories?post=21304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techclass.wfjydl.com\/wp-json\/wp\/v2\/tags?post=21304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}