micro:bitのUARTを使って、PCとシリアル通信するのを試してみた。
microPythonで以下のようなプログラムを書いた。
from microbit import display, Image, uart
display.show(Image.HAPPY)
uart.init(baudrate=9600, bits=8, parity=None, stop=1)
uart.write("\r\n*** UART test ***\r\n")
while True:
if uart.any():
s=uart.read() # read 1 byte
uart.write(s) # echo back
display.show(chr(s[0])) # show to led











