Created
October 1, 2016 20:16
-
-
Save ZanderBrown/e5d6675cc913c2f48f1b047c10f5c585 to your computer and use it in GitHub Desktop.
A chat system using the Micro:Bit for communication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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