Skip to content

Instantly share code, notes, and snippets.

@ZanderBrown
Created October 1, 2016 20:16
Show Gist options
  • Save ZanderBrown/e5d6675cc913c2f48f1b047c10f5c585 to your computer and use it in GitHub Desktop.
Save ZanderBrown/e5d6675cc913c2f48f1b047c10f5c585 to your computer and use it in GitHub Desktop.
A chat system using the Micro:Bit for communication
from microbit import *
import radio
uart.init()
radio.on()
uart.write("\r\nWelcome\r\n")
while True:
input = uart.readline()
if input is not None and len(input) > 0:
uart.write(str(input,'utf-8'))
radio.send(str(input,'utf-8'))
display.show(">")
msg = radio.receive()
if msg is not None:
uart.write(str(msg).replace('\n', '\r\n'))
display.show("<")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment