{"id":1271,"date":"2021-12-08T07:31:39","date_gmt":"2021-12-07T22:31:39","guid":{"rendered":"https:\/\/okamoto3.com\/?p=1271"},"modified":"2023-03-01T19:02:55","modified_gmt":"2023-03-01T10:02:55","slug":"raspberry-pi-os-buzzer","status":"publish","type":"post","link":"https:\/\/okamoto3.com\/index.php\/2021\/12\/08\/raspberry-pi-os-buzzer\/1271\/","title":{"rendered":"Raspberry pi OS \u30d6\u30b6\u30fc\u53d6\u308a\u4ed8\u3051 \u306f\u3093\u3060\u4ed8\u3051\u7121\u3057 gpiozero Python3"},"content":{"rendered":"<p>\u30a2\u30a4\u30cd\u30c3\u30af\u30b9 \u5b9f\u9a13\u7528\u30b9\u30a4\u30c3\u30c1\u30fbLED\u30bb\u30c3\u30c8 KM-01\u4f7f\u3048\u306f\u3001\u306f\u3093\u3060\u4ed8\u3051\u8981\u3089\u3093\u3053\u3068\u306b\u6c17\u304c\u3064\u3044\u305f\u3002\u30d6\u30b6\u30fc\u7de8\u3002<\/p><h2 class=\"wp-block-heading\">\u4f7f\u3046\u3082\u306e<\/h2><p><center><br \/>\n<iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"https:\/\/rcm-fe.amazon-adsystem.com\/e\/cm?ref=tf_til&amp;t=shigeki3-22&amp;m=amazon&amp;o=9&amp;p=8&amp;l=as1&amp;IS1=1&amp;detail=1&amp;asins=B000FHQADO&amp;linkId=1e44b2094bfe9eb3f3b9614ac39ccce1&amp;bc1=ffffff&amp;lt1=_top&amp;fc1=333333&amp;lc1=0066c0&amp;bg1=ffffff&amp;f=ifr\"><br \/>\n    <\/iframe><br \/>\n<\/center><\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/amzn.to\/3rFz25q\">\u30a2\u30de\u30be\u30f3\u3067\u898b\u308b<\/a><\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"247\" height=\"453\" src=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211206_164551-01_copy_247x453.jpeg?resize=247%2C453&#038;ssl=1\" alt=\"\" class=\"wp-image-1251\" srcset=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211206_164551-01_copy_247x453.jpeg?w=247&amp;ssl=1 247w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211206_164551-01_copy_247x453.jpeg?resize=164%2C300&amp;ssl=1 164w\" sizes=\"auto, (max-width: 247px) 100vw, 247px\" \/><figcaption class=\"wp-element-caption\">\u300c\u691c\u8a3c\u30de\u30cb\u30a2\u300d\u30a8\u30a8\u540d\u524d\u3058\u3083<\/figcaption><\/figure><\/div><figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"294\" src=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211206_164639-01_copy_442x294.jpeg?resize=442%2C294&#038;ssl=1\" alt=\"\" class=\"wp-image-1252\" srcset=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211206_164639-01_copy_442x294.jpeg?w=442&amp;ssl=1 442w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211206_164639-01_copy_442x294.jpeg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><figcaption class=\"wp-element-caption\">\u30ea\u30fc\u30c9\u7dda\u304c\u77ed\u3044\u304b\u3089Raspberry Pi\u306b\u30a8\u30a8<\/figcaption><\/figure><p>\u97f3\u304cbeep\u97f3\u306a\u306e\u3067\u3001\u3053\u3053\u3067\u306f\u30d6\u30b6\u30fc\u3068\u8868\u73fe\u3057\u305f\u3051\u3069\u3001\u96fb\u6e90\u3092\u5165\u308c\u305f\u3060\u3051\u3067\u306f\u9cf4\u3089\u306a\u3044\u3084\u3064\u3002<\/p><h2 class=\"wp-block-heading\">\u30d6\u30b6\u30fc(\u30b9\u30d4\u30fc\u30ab\u30fc)\u306e\u53d6\u4ed8<\/h2><p>Raspberry Pi\u306e\u30d4\u30f3\u306e\u3046\u3061\u3001GND\u30d4\u30f3\u3068GPIO\u30d4\u30f3\u306b\u307e\u305f\u3044\u3067\u5dee\u3059\u3002\u305f\u3060\u3057\u3001\u30d4\u30f3\u306e\u5e45\u304c4\u30d4\u30f3\u306a\u306e\u3067\u3001\u4f7f\u3048\u3093\u30d4\u30f3\u304c\u51fa\u308b\u3051\u3069\u306a\u3002<\/p><p>\u4eca\u56de\u306f\u3001<strong>GPIO18(12\u756a\u30d4\u30f3)\u3068GND(6\u756a\u30d4<\/strong>\u30f3)\u306b\u5dee\u3057\u8fbc\u3093\u3060\u3002<\/p><p>\u3053\u3053\u306a\u3089\u3001GPIO\u306e\u6307\u5b9a\u3057\u3068\u3089\u3093\u304b\u3063\u305f\u3089\u3001\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u306eTX(8\u756a\u30d4\u30f3)\u3068RX(10\u756a\u30d4\u30f3)\u306a\u3093\u3067\u88ab\u5bb3\u304c\u5c11\u306a\u3044\u306f\u305a\u3058\u3083\u3002<\/p><figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"435\" height=\"337\" src=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211208_043015-01_copy_435x337.jpeg?resize=435%2C337&#038;ssl=1\" alt=\"\" class=\"wp-image-1285\" srcset=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211208_043015-01_copy_435x337.jpeg?w=435&amp;ssl=1 435w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211208_043015-01_copy_435x337.jpeg?resize=300%2C232&amp;ssl=1 300w\" sizes=\"auto, (max-width: 435px) 100vw, 435px\" \/><figcaption class=\"wp-element-caption\">\u3053\u3053\u3058\u3083<\/figcaption><\/figure><h2 class=\"wp-block-heading\">\u30d7\u30ed\u30b0\u30e9\u30e0<\/h2><p><strong>gpiozero<\/strong>\u306e<strong>tonalbuzzer<\/strong>\u3092\u4f7f\u3063\u3066\u3084\u3063\u3066\u307f\u305f\u3002Python3 \u3058\u3083\u3002<\/p><p>\u308f\u3057\u306f\u3001\/home\/pi\/projects\/tonalbuzzer\u306b\u4f5c\u3063\u305f\u3002<\/p><ul class=\"wp-block-list\"><li><strong>mkdir \/home\/pi\/projects<\/strong><\/li>\n\n<li><strong>cd<\/strong> <strong>\/home\/pi\/projects<\/strong><\/li>\n\n<li><strong>mkdir tonalbuzzer<\/strong><\/li>\n\n<li><strong>cd tonalbuzzer<\/strong><\/li>\n\n<li><strong>nano narasu.py<\/strong><\/li><\/ul><pre class=\"wp-block-preformatted\">from gpiozero import TonalBuzzer <br>from time import sleep <br>bz = TonalBuzzer(18) <br>   bz.play(880) <br>   sleep(1) <br>   bz.stop()<\/pre><p>ctrl+z\u3067\u4fdd\u5b58<\/p><p><strong>\u5b9f\u884c<\/strong><\/p><ul class=\"wp-block-list\"><li><strong>Python3 narasu.py<\/strong><\/li><\/ul><p>1\u79d2\u307b\u3069880Hz\u3067\u9cf4\u308b\u3067\u3002\u6700\u5f8c\u3001\u97f3\u304c\u30b7\u30e7\u30dc\u304f\u306a\u308b\u3051\u3069\u306a\u3002<\/p><pre class=\"wp-block-preformatted\">from gpiozero import TonalBuzzer <br>from time import sleep <br><br>bz = TonalBuzzer(18) <br><br>for t in range(3): <br>    bz.play(440) <br>    sleep(0.2) <br>    bz.stop() <br>    sleep(0.8) <br><br>bz.play(880) <br>sleep(2.5) <br>bz.stop()<\/pre><p>\u30b8\u30b8\u30a4\u306f\u3053\u308c\u3092\u3064\u3044\u3084\u3063\u3066\u3057\u307e\u3046\u3002<\/p><p>\u4ee5\u4e0a\uff01<\/p><hr class=\"wp-block-separator has-css-opacity\"\/><figure class=\"wp-block-embed is-type-wp-embed is-provider-sgg-039-s wp-block-embed-sgg-039-s\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"TlqeMZYLD6\"><a href=\"https:\/\/okamoto3.com\/index.php\/2021\/12\/10\/gpiozero-pinout\/1321\/\">raspberry pi \u30d4\u30f3\u78ba\u8a8d pinout \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;raspberry pi \u30d4\u30f3\u78ba\u8a8d pinout \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb&#8221; &#8212; sGG&#039;s\" src=\"https:\/\/okamoto3.com\/index.php\/2021\/12\/10\/gpiozero-pinout\/1321\/embed\/#?secret=TlqeMZYLD6\" data-secret=\"TlqeMZYLD6\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><figcaption class=\"wp-element-caption\">\u52d5\u304b\u306a\u3044\u5834\u5408\u306e\u53c2\u8003<\/figcaption><\/figure><hr class=\"wp-block-separator has-css-opacity\"\/><div class=\"wp-block-image is-style-rounded\"><figure class=\"aligncenter size-thumbnail\"><a href=\"https:\/\/youtube.com\/user\/hishigeki3\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/10\/Screenshot_2021-10-25-07-00-51-667_com.google.android.youtube-01_copy_270x246.jpeg?resize=150%2C150&#038;ssl=1\" alt=\"\" class=\"wp-image-658\" srcset=\"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/10\/Screenshot_2021-10-25-07-00-51-667_com.google.android.youtube-01_copy_270x246.jpeg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/10\/Screenshot_2021-10-25-07-00-51-667_com.google.android.youtube-01_copy_270x246.jpeg?resize=100%2C100&amp;ssl=1 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><figcaption class=\"wp-element-caption\">\u3088\u308d\u3057\u3051\u308c\u3070\u30c1\u30e3\u30f3\u30cd\u30eb\u767b\u9332\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u7533\u3057\u4e0a\u3052\u307e\u3059\uff01<\/figcaption><\/figure><\/div><hr class=\"wp-block-separator has-css-opacity\"\/><p><center><br \/>\n<iframe loading=\"lazy\" src=\"https:\/\/rcm-fe.amazon-adsystem.com\/e\/cm?o=9&amp;p=20&amp;l=ez&amp;f=ifr&amp;linkID=865d8e3440677383d9b2493a3354bc42&amp;t=shigeki3-22&amp;tracking_id=shigeki3-22\" width=\"120\" height=\"90\" scrolling=\"no\" border=\"0\" marginwidth=\"0\" style=\"border:none;\" frameborder=\"0\"><\/iframe><br \/>\n<\/center><\/p>","protected":false},"excerpt":{"rendered":"<p>\u30a2\u30a4\u30cd\u30c3\u30af\u30b9 \u5b9f\u9a13\u7528\u30b9\u30a4\u30c3\u30c1\u30fbLED\u30bb\u30c3\u30c8 KM-01\u4f7f\u3048\u306f\u3001\u306f\u3093\u3060\u4ed8\u3051\u8981\u3089\u3093\u3053\u3068\u306b\u6c17\u304c\u3064\u3044\u305f\u3002\u30d6\u30b6\u30fc\u7de8\u3002 \u4f7f\u3046\u3082\u306e \u30a2\u30de\u30be\u30f3\u3067\u898b\u308b \u97f3\u304cbeep\u97f3\u306a\u306e\u3067\u3001\u3053\u3053\u3067\u306f\u30d6\u30b6\u30fc\u3068\u8868\u73fe\u3057\u305f\u3051\u3069\u3001\u96fb\u6e90\u3092\u5165\u308c\u305f\u3060\u3051\u3067\u306f\u9cf4\u3089\u306a\u3044\u3084\u3064\u3002&hellip; <a class=\"more-link\" href=\"https:\/\/okamoto3.com\/index.php\/2021\/12\/08\/raspberry-pi-os-buzzer\/1271\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">Raspberry pi OS \u30d6\u30b6\u30fc\u53d6\u308a\u4ed8\u3051 \u306f\u3093\u3060\u4ed8\u3051\u7121\u3057 gpiozero Python3<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1298,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[23,213,149],"tags":[126],"class_list":["post-1271","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi","category-all-articles","category-production","tag-raspberry-pi","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/okamoto3.com\/wp-content\/uploads\/2021\/12\/IMG_20211208_043053-01_copy_411x375.jpeg?fit=411%2C375&ssl=1","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/1271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/comments?post=1271"}],"version-history":[{"count":17,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/1271\/revisions"}],"predecessor-version":[{"id":3081,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/posts\/1271\/revisions\/3081"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/media\/1298"}],"wp:attachment":[{"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/media?parent=1271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/categories?post=1271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/okamoto3.com\/index.php\/wp-json\/wp\/v2\/tags?post=1271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}