Setting Up the micro:bit

The first time the micro:bit is powered up you will need to rotate it so a circle is drawn on the micro:bit.
Once this is done you are ready to connect to it with the Raspberry Pi

Finding the micro:bit

If this is the first time this combination of Raspberry Pi and micro:bit have been used together then you will
need to ensure the micro:bit is in the list of known Bluetooth devices on the Raspberry Pi. You will do this
using bluetoothctl.

Note: There is ‘tab’ command completion on commands and addresses available within the bluetoothctl tool.

Note: As Bluetooth addresses are unique this workshop uses the representation of your Raspberry Pi and
micro:bit address as xx:xx:xx:xx:xx:xx and yy:yy:yy:yy:yy:yy respectively. Please replace these
with the actual address of your devices

Using bluetoothctl

You will use the command line tool “bluetoothctl” to discover our micro:bit.
On the terminal command line type:
$ bluetoothctl

You will then get the new prompt:
[bluetooth]#

You can type help to get a full list of the commands.
Check that the Bluetooth is switched on on the Raspberry Pi
Type show and check that you have Powered: yes.
For example:

Connect to micro:bit

You need to specify the Bluetooth address of your micro:bit (found with the above command) to connect to it.
Because you have used the “no pairing required” hex file the micro:bit will become part
of the known devices once it has been connected to and allow you to easily access
it from the Python code
Once connection has happened and a "C" appears on the micro:bit you can disconnect.