0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

micro:bitがしゃべった!追加ハードウェアなし!

Last updated at Posted at 2025-12-21

先日micro:bit Python Editorを眺めていると”Speech”の項目がありました。

ブロックプログラミング環境のMakeCode の方ではメロディーや音符を鳴らすことはできましたがmicro:bitにしゃべらせるという話は聞いたことがありません。

早速試してみました!

最初の一歩

とりあえず数字のカウントダウンと単語をしゃべらせることに成功しました。
V1を使っているのでスピーカーをつないでいますがV2ならハードウェア追加は不要です。

サンプルプログラム
サンプルプログラム.py
import speech
from microbit import *

while True:
    if button_a.was_pressed():
        display.show(5)
        speech.say("5")
        sleep(100)
        display.show(4)
        speech.say("4")
        sleep(100)
        display.show(3)
        speech.say("3")
        sleep(100)
        display.show(2)
        speech.say("2")
        sleep(100)
        display.show(1)
        speech.say("1")
        sleep(100)
        display.show(0)
        speech.say("0")
        sleep(100)

        
    if button_b.was_pressed():
        speech.say("YES")    
        display.show('YES') 
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?