These instructions work for Linux and Windows WSL 2 Linux.
-
Connect the Microbit via USB to the computer.
-
Run the following command to determine the TTY name.
sudo dmesg | grep ttyThe output should be similar to this. If the device has been plugged in and unplugged multiple times, there may be multiple entries for the USB ACM device.
[ 0.194755] printk: legacy console [tty0] enabled [ 380.728430] cdc_acm 3-2:1.1: ttyACM0: USB ACM deviceThe
ttyACM0is the device node of the Microbit. Use this device node when running the following commands. -
The device node is accessed via the file system because everything is a file in Linux.
ls -l /dev/ttyACM0
The output should be similar to this.
crw-rw---- 1 root dialout 166, 0 Oct 5 09:55 /dev/ttyACM0 -
Run the following command to output data to the Microbit.
echo 'Hello, world!' > /dev/ttyACM0
The 'Hello, world!' string will not be displayed in the terminal, but the orange light on the Microbit will flash each time you run the command.
-
Run the Tio program to establish a serial connection to the Microbit. The default settings for Tio are sufficient.
tio /dev/ttyACM0
-
Open a new terminal window, and change into the
projects/06_microbit_send_stringfolder. Run the following command to flash the program to the Microbit.cargo embed
-
Review the
tioconsole and the text "The quick brown fox jumps over the lazy dog." should appear. Push the reset button on the Microbit and the text should be outputted to the Tio console again and again. -
To exit Tio, in the Tio terminal window, type
ctrl+t, followed byq. -
To exit the Rust embedded program, type
ctrl+c.