Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run on top of micropython #43

Open
Zzx-J opened this issue May 28, 2023 · 4 comments
Open

Cannot run on top of micropython #43

Zzx-J opened this issue May 28, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Zzx-J
Copy link

Zzx-J commented May 28, 2023

Hi I just followed the instruction on https://learn.adafruit.com/circuitpython-libraries-on-micropython-using-the-raspberry-pi-pico/overview to run Circuitpython libraries on top of Micropython on Raspberry Pi Pico W.

I have installed all the libraries needed according to the instruction, when running the example code the IDE pops up with the following issue:

Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "adafruit_bno08x/i2c.py", line 27, in __init__
  File "adafruit_bno08x/__init__.py", line 506, in __init__
  File "adafruit_bno08x/__init__.py", line 512, in initialize
  File "adafruit_bno08x/__init__.py", line 1063, in soft_reset
  File "adafruit_bno08x/i2c.py", line 38, in _send_packet
  File "adafruit_bno08x/__init__.py", line 380, in __init__
  File "adafruit_bno08x/__init__.py", line 456, in header_from_buffer
TypeError: function doesn't take keyword arguments

The code I used:

import board
import busio
from adafruit_bno08x.i2c import BNO08X_I2C
from adafruit_bno08x import BNO_REPORT_ACCELEROMETER

i2c = busio.I2C(scl=board.GP15, sda = board.GP14)
bno = BNO08X_I2C(i2c)
bno.enable_feature(BNO_REPORT_ACCELEROMETER)

while True:
    accel_x, accel_y, accel_z = bno.acceleration  # pylint:disable=no-member
    print("X: %0.6f  Y: %0.6f Z: %0.6f  m/s^2" % (accel_x, accel_y, accel_z))

I have tried the bme280 library provided by the instruction and it works, which I believe proved that I have correctly installed the library. The reason that I need to use micropython is that I want to use the multicore function.

Anybody please help.

@tekktrik
Copy link
Member

It looks like MicroPython implements struct.unpack_from() to only take positional arguments: https://docs.micropython.org/en/latest/library/struct.html#struct.unpack_from

Uses of it in this library will need to provide it positionally only in order to keep compatibility. If you're up for submitting a pull request to fix it, we'd be happy to take a look!

@tekktrik tekktrik added bug Something isn't working good first issue Good for newcomers labels May 29, 2023
@dobodu
Copy link

dobodu commented Jun 9, 2023

Hi Zzx-J and tekktrik

I'm in the same case,
I adapted the CircuitPython Library to Micropython in this repo

Some things seems to work (initialisation, can request and read the BNO ID, and many things) but I lack debugging skills to finish the project (I'm struggling for 2 weeks). Obviously I miss something.

If one can help...

@tekktrik
Copy link
Member

I can take a look this week

@dobodu
Copy link

dobodu commented Jun 12, 2023 via email

@adafruit-adabot adafruit-adabot added the Hacktoberfest DigitalOcean's Hacktoberfest label Sep 29, 2023
@dhalbert dhalbert removed good first issue Good for newcomers Hacktoberfest DigitalOcean's Hacktoberfest labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants