Skip to content

Instantly share code, notes, and snippets.

@jake-walker
Last active December 18, 2025 10:56
Show Gist options
  • Select an option

  • Save jake-walker/0b46b479f589b3978442b74d7b86d6ab to your computer and use it in GitHub Desktop.

Select an option

Save jake-walker/0b46b479f589b3978442b74d7b86d6ab to your computer and use it in GitHub Desktop.
A simple BBC Micro:bit script that allows you to send radio messages to another Micro:bit that is running this same script
from microbit import *
import radio
# --- CONFIG ---
# Deadzone
deadzone = 350
# Scroll Speed (ms)
scrollspeed = 500
current = 1
characters = [" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", " "]
message = []
space = Image("00000:"
"00000:"
"00000:"
"90009:"
"99999")
newMessage = Image("05950:"
"50505:"
"95059:"
"99599:"
"99999")
tick = Image("00000:"
"00009:"
"00090:"
"90900:"
"09000")
radio.on()
def drawChar():
if characters[current] == " ":
display.show(space)
else:
display.show(characters[current])
def appendCurrent():
if button_a.is_pressed():
message.append(characters[current])
print(''.join(message))
display.show(Image().invert())
sleep(scrollspeed)
elif button_b.is_pressed():
radio.send(''.join(message))
message = []
current = 1
display.show(tick)
sleep((scrollspeed * 2))
def checkForMessages():
incoming = radio.receive()
if incoming:
display.show(newMessage)
sleep(250)
display.clear()
sleep(250)
display.show(newMessage)
sleep(250)
display.clear()
sleep(250)
display.show(newMessage)
sleep(250)
display.clear()
sleep(250)
display.show(newMessage)
sleep(250)
display.clear()
sleep(250)
display.scroll(incoming)
while True:
reading = accelerometer.get_x()
checkForMessages()
if reading > deadzone:
if current < (len(characters) - 1):
current = current + 1
drawChar()
appendCurrent()
sleep(scrollspeed)
elif reading < (deadzone * -1):
if current > 0:
current = current - 1
drawChar()
appendCurrent()
sleep(scrollspeed)
else:
drawChar()
appendCurrent()
@cooldudefncs
Copy link

does not work

@jake-walker
Copy link
Author

jake-walker commented Dec 18, 2025

does not work

@cooldudefncs: This is a few years old now and I expect the microbit package has come a way on since. I may be able to help if you have any error messages or any more detail?

@cooldudefncs
Copy link

oh I was just trying to make my own Messager and voice call system so i was looking at ones that work

@cooldudefncs
Copy link

can you help me with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment