1. Log micro:bit compass to serial port via USB and trace/track position on screen with Turtle graphic
// Direct serial output (and input) to the USB connection
serial.redirectToUSB();
// write current compass heading to serial port (via USB connection)
serial.writeLine("" + input.compassHeading())
- Identify connected serial device
dmesg | grep tty
- Display serial input on device eg. ttyACM3
sudo screen /dev/ttyACM3 115200
end and kill screen session with strg+a k
# Listen on serial device, eg. ttyACM3
ser = serial.Serial('/dev/ttyACM3', 115200, timeout=1)
# read serial input
ser.readline()