Thursday 18 August 2016

BBC Micro:bit calls CQ CQ...

There is a new module available for the BBC micro:bit in the MicroPython programming language. This is a speech generating module.

The results are crude, unless you very carefully adjust the message content and speech settings. But it works out of the box.

Here is a short program to call CQ for myself, M6KWH.

Code

# Call CQ M6KWH
from microbit import *
import speech

# init pin0 to 0 to define a level and stop "hum"
pin0.write_digital(0)

message = "C Q! C Q! C Q!   M 6 K W H! calling C Q!"
while True:
    # flash arrow W
    display.show(Image.ARROW_W)
    sleep(500)
    display.clear()
    sleep(500)
    
    # if A pressed, say greetings
    if button_a.was_pressed():
        speech.say(message, speed=80)
        sleep(1000)

No comments: