aioble: AttributeError: 'module' object has no attribute 'Service' (and - no instructions, and lack of useful examples)
It is not clear from this page:-
https://github.com/micropython/micropython-lib/tree/master/micropython/bluetooth/aioble#passive-scan-for-nearby-devices-for-5-seconds-observer
how to use any of that code
>>> import l2cap_file_server
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "l2cap_file_server.py", line 53, in <module>
AttributeError: 'module' object has no attribute 'Service'
>>>
we need to be told what to do to make it work, and there needs to be working examples to show the features - especially the "scan" - and the examples need to tell you what you need to to do run them.
even the multitests don't seem to work? (and there's no tests for the scan feature):
MicroPython v1.21.0 on 2023-10-06; Generic ESP32 module with OTA with ESP32
Type "help()" for more information.
>>> import notify
>>> notify.instance1()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "notify.py", line 148, in instance1
AttributeError: 'module' object has no attribute 'stop'
>>>
disclaimer: I'm not an expert in MicroPython
Input Pins 1 and 2 do not work of the 8
Port, board and/or hardware
ARDUINO_OPTA
MicroPython version
MicroPython v1.24.0 on 2024-10-25; Arduino OPTA with STM32H747
Reproduction
import machine
from machine import Pin
pin1 = Pin("IN_1")
pin1.value()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'value'
pin1.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=self._callback)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'irq'
pin2 = Pin("IN_2")
pin2.value()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'value'
pin2.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=self._callback)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Pin' object has no attribute 'irq'
Expected behaviour
pin3 = Pin("IN_3")
pin3.value()
0
Observed behaviour
Pin 1 and 2 do not work.
It seems that the pin 1 and 2 are not instantiated correctly. Whether with IN_1 or PA0_C.
Pins 3 to 8 work both ways.
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
I had the problem when I try to use aioble compiled in as a module in MicroPython. When I install aioble with mpi on the board itself, everything works.
@gitcnd Does installing the module with mip solve the problem, as suggested by @fpetzold ?
Installing the module with mip solve the problem also for me.
thank's @fpetzold