bbc-microbit

Is there any way to find the five character ID of the micro:bit in micropython?


This is how we get the device name using MakeCode for micro:bit

basic.showString(control.deviceName())

But i can't find a way to do it in micropython.

And the Makecode python implementation throws an error in normal micropython:

from microbit import *
while True:
    basic.show_string(control.device_name())

Solution

  • micropython for the micro:bit is different from the code used in the MakeCode editor.

    They are both based on Hardware Abstraction Layer defined at the following location: https://lancaster-university.github.io/microbit-docs/concepts/

    The documentation for micropython is available at: https://microbit-micropython.readthedocs.io/en/v1.0.1/microbit_micropython_api.html

    There is not a unique name in the same way that there is in blocks.