Giter VIP home page Giter VIP logo

Comments (5)

ar0berts avatar ar0berts commented on July 19, 2024

and... even when install smbus2 and put the smbus2.py file in the pico I get ImportError: can't import name SMBus. I'm not sure whether there is a circular dependency and am working through the smbus2.py file to try to fix it but it's probably something else!
Still stuck :-(

Andrew
smbus2.py.txt

from bmp280-python.

Gadgetoid avatar Gadgetoid commented on July 19, 2024

All of our Python libraries were written exclusively for the Raspberry Pi SBCs under Linux/Raspbian, and are not intended to run on the Pico. MicroPython and "real" Python are quite a world apart.

We ship our own version of MicroPython with driver for various sensors baked in- see: https://github.com/pimoroni/pimoroni-pico/releases/tag/v1.18.0

from bmp280-python.

ar0berts avatar ar0berts commented on July 19, 2024

Thanks,

I have installed v1.18.0 from the Pimoroni git page now the link is fixed and running the example temperature-and-pressure.py script for the bmp280 gives:

MicroPython v1.18 on 2022-01-27; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 8, in <module>
ImportError: no module named 'smbus'
>>> 

I'm baffled, having an smbus2.py script in the pico it's not used by
try: from smbus2 import SMBus except ImportError: from smbus import SMBus
If I alter temperature-and-pressure.py to just call from smbus2 import SMBus I get

>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "smbus2.py", line 25, in <module>
  File "fcntl.py", line 1, in <module>
  File "ffi.py", line 5, in <module>
ImportError: no module named 'threading'
>>> 

Again,a dead end with a missing module as sudo pip3 install threading doesn't produce anything.
I'm on python 3.8.5 on ubuntu 20.04 LTS.

Any pointers to where to go next gratefully received

Andrew

from bmp280-python.

Gadgetoid avatar Gadgetoid commented on July 19, 2024

None of the code or examples in this repository will work- you need: https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/breakout_bmp280/demo_bmp280.py

All the Pico MicroPython examples live here - https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples

I… uh… have no clue where that “Hello” is coming from!

from bmp280-python.

ar0berts avatar ar0berts commented on July 19, 2024

Thanks (and Hello!),
That code works perfectly. - Please close
Andrew

from bmp280-python.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.