# Importing bluetooth module in micropython

**URL:** https://forum.makecode.com/t/importing-bluetooth-module-in-micropython/36374
**Category:** micro:bit
**Created:** [May 4, 2025, 9:43pm UTC](https://forum.makecode.com/t/importing-bluetooth-module-in-micropython/36374 "2025-05-04T21:43:16Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [May 5, 2025, 2:24pm UTC](https://forum.makecode.com/t/importing-bluetooth-module-in-micropython/36374/2 "2025-05-05T14:24:43Z")

</div>

Hi @microzirtik ,

MakeCode doesn’t provide access to customize Bluetooth advertising or to create custom services, but you can use the provided services. And rather than a custom service, you can use the UART service to exchange messages and do custom things. Many mobile apps that interact with micro:bits use this approach and can often be easily used to interact with the micro:bit in applications the app wasn’t originally meant for. There are some examples of that elsewhere in this forum, like the discussion at: [Android app/Discord - #8 by bsiever](https://forum.makecode.com/t/android-app-discord/7696/8)

You can control advertising and characteristics via C/C++ and through MakeCode via C++ based extensions.

I wrote MakeCode BLE HID blocks that control the advertising and create services ([here](https://github.com/bsiever/microbit-pxt-blehid)). It provides some examples of how to customize advertising.

I’ve also written a bluetooth service to retrieve the datalogger data ([here](https://github.com/bsiever/pxt-blelog)). There’s a corresponding JavaScript library/webpage to retrieve the data from a computer [here](https://bsiever.github.io/microbit-webblelog/) ([source](https://github.com/bsiever/microbit-webblelog)) or a more user-friendly prototype website at [https://2024-ui-sp.github.io/Micro-bit-ble/](https://2024-ui-sp.github.io/Micro-bit-ble/) ([source](https://github.com/2024-UI-SP/Micro-bit-ble/)) . This work may be a better example of writing a custom service than the BLE HID blocks.

Hope that helps a bit,  
Bill

P.S. According to the docs, the other version of Python, micropython, doesn’t support BLE for anything other than flashing. See [https://microbit-micropython.readthedocs.io/en/v2-docs/ble.html](https://microbit-micropython.readthedocs.io/en/v2-docs/ble.html).

---

_[View the full topic](https://forum.makecode.com/t/importing-bluetooth-module-in-micropython/36374)._
