{"id":2516,"date":"2023-08-05T11:35:30","date_gmt":"2023-08-05T03:35:30","guid":{"rendered":"https:\/\/104.es\/?p=2516"},"modified":"2023-08-06T17:34:19","modified_gmt":"2023-08-06T09:34:19","slug":"microbitmicropython-dht11","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2023\/08\/05\/microbitmicropython-dht11\/","title":{"rendered":"\u3010micro:bit\u3011MicroPython DHT11\u6eab\u6fd5\u5ea6\u611f\u6e2c\u5668"},"content":{"rendered":"\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7d71\u4e2d\u5e38\u898b\u7684\u6eab\u6fd5\u5ea6\u611f\u6e2c\u5668DHT11\uff0c\u5728micro:bit\u4e2d\u4e5f\u53ef\u4ee5\u4f7f\u7528MicroPython\u4f86\u5b8c\u6210\u91cf\u6e2c\u7684\u7a0b\u5f0f\u3002\u9019\u6b21\u6211\u5011\u4f7f\u7528\u662f\u4ee5\u4e0b\u7684\u9019\u500b\u6a21\u7d44\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/rhubarbdog\/microbit-dht11\">https:\/\/github.com\/rhubarbdog\/microbit-dht11<\/a><\/p>\n\n\n\n<p>\u540c\u6a23\u5730\uff0c\u8acb\u4e0b\u8f09\u4e4b\u5f8c\u89e3\u58d3\u7e2e\uff0c\u7136\u5f8c\u628adht11.py\u4e0a\u50b3\u5230micro:bit\u677f\u5b50\u4e0a\uff0c\u5229\u7528\u4ee5\u4e0b\u7684\u7a0b\u5f0f\u5373\u53ef\u8b93micro:bit\u7684LED\u986f\u793a\u5668\u4ee5\u6372\u52d5\u7684\u65b9\u5f0f\u986f\u793a\u51fa\u76ee\u524d\u6b63\u78ba\u7684\u74b0\u5883\u6eab\u6fd5\u5ea6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from microbit import *\nfrom dht11 import DHT11\n\nwhile True:\n    sensor = DHT11(pin0)\n    t, h = sensor.read()\n    display.scroll(\"{}C,{}%\".format(t, h))\n    sleep(2000)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7d71\u4e2d\u5e38\u898b\u7684\u6eab\u6fd5\u5ea6\u611f\u6e2c\u5668DHT11\uff0c\u5728micro:bit\u4e2d\u4e5f\u53ef\u4ee5\u4f7f\u7528MicroPython\u4f86\u5b8c\u6210\u91cf\u6e2c\u7684\u7a0b\u5f0f\u3002\u53ea\u8981\u532f\u5165\u5225\u4eba\u5beb\u597d\u7684dht\u6a21\u7d44\uff0c\u5728\u7a0b\u5f0f\u4e2d\u547c\u53eb\u5c31\u53ef\u4ee5\u5f97\u5230\u6211\u5011\u60f3\u8981\u7684\u6578\u503c\u4e86\u3002<\/p>\n","protected":false},"author":1,"featured_media":2842,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11,15],"tags":[],"class_list":["post-2516","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microbit","category-python"],"jetpack_featured_media_url":"https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-26.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/comments?post=2516"}],"version-history":[{"count":1,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2516\/revisions"}],"predecessor-version":[{"id":2518,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2516\/revisions\/2518"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media\/2842"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=2516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=2516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=2516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}