bluetooth vs ubluetooth

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
mflmartin
Posts: 43
Joined: Sat Jul 23, 2016 7:30 pm

bluetooth vs ubluetooth

Post by mflmartin » Thu Feb 04, 2021 10:13 pm

Hi!

I am looking at the latest docs, and they tell me that the module to use, is the ubluetooth. Nevertheless, for the latest image available for the ESP32, that lib does not get recognized. Moreover, only "bluetooth" module works. And the examples in the bluetooth examples use "bluetooth" and not "ubluetooth"


Docs: http://docs.micropython.org/en/latest/l ... tooth.html

Examples: https://github.com/micropython/micropyt ... /bluetooth

Is there something I am missing out?

Thanks,

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: bluetooth vs ubluetooth

Post by jimmo » Fri Feb 05, 2021 12:27 am

mflmartin wrote:
Thu Feb 04, 2021 10:13 pm
I am looking at the latest docs, and they tell me that the module to use, is the ubluetooth. Nevertheless, for the latest image available for the ESP32, that lib does not get recognized. Moreover, only "bluetooth" module works. And the examples in the bluetooth examples use "bluetooth" and not "ubluetooth"
The sumary is that the module is called "ubluetooth" but MicroPython has a feature where any ufoo module is also available as foo, if foo is not available elsewhere. This is described here: http://docs.micropython.org/en/latest/l ... -libraries.

The idea is that you could write foo.py, to provide a more feature-full version of ufoo, and then have foo.py import all the base functionality from ufoo.

e.g.

Code: Select all

foo.py:
from ufoo import *

def extra_thing():
  pass
I just tested the v1.14 release binary on my TinyPICO and was able to import both ubluetooth and bluetooth. Can you confirm which firmware file (e.g. what's the .bin filename) and version of MicroPython that you have?

mflmartin
Posts: 43
Joined: Sat Jul 23, 2016 7:30 pm

Re: bluetooth vs ubluetooth

Post by mflmartin » Fri Feb 05, 2021 12:34 am

Noted, Thanks!

Post Reply