Skip to content

Serial communications

Using the micro:bit USB port it is possible to establish a serial link between the micro:bit and any PC.

Serial communications are useful for debugging, but also to transfer data or commands from and to the micro:bit.

Using python on the computer, install pyserial first

> pip install pyserial

This code will read data from the Microbit and print it on the screen of the computer

import serial

ser =serial.Serial("/dev/tty.usbmodem141302",115200)

while True:
    ch = ser.read()
    print ch