0

This is how we get the device name using blocks

enter image description here

But I need to find the way to code in micropython to find the same.

I have tried the following:

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

But this throws an error!

ukBaz
  • 6,985
  • 2
  • 8
  • 31
Itty Bit
  • 23
  • 4

1 Answers1

2

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.

ukBaz
  • 6,985
  • 2
  • 8
  • 31