Circuitpython and I2C challanges

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
milhousehouten
 
Posts: 2
Joined: Tue Jan 31, 2023 7:33 am

Circuitpython and I2C challanges

Post by milhousehouten »

So I have been googling on the web for days now without solving my problem, I hope somebody here has seen the issue and could help me out.

I have a Raspberry Pi Pico with adafruit-circuitpython-raspberry_pi_pico-en_GB-7.3.3.uf2.
I try to enable a Adafruit I2C QT Rotary Encoder following the guide on https://learn.adafruit.com/adafruit-i2c ... cuitpython but encounter an error which one the line i2c = board.I2C() which says :

Traceback (most recent call last):
File "<stdin>", line 14, in <module>
AttributeError: 'module' object has no attribute 'I2C'

I have tried with both the Mu Editor and Thonny copy and past back and forth in different ways without any progress. It seems I can't enable the I2C bus and I can't understand what I have missed.

I have tried with only the code below without and success either:

import board
from adafruit_seesaw import seesaw, rotaryio, digitalio
i2c = board.I2C()

I have downloaded the adafruit_seesaw lib into the Pico as well as you can see on the pic.
Attachments
Skärmbild 2023-01-31 124618.png
Skärmbild 2023-01-31 124618.png (83.44 KiB) Viewed 76 times

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Circuitpython and I2C challanges

Post by danhalbert »

We don't have a `board.I2C()` for Raspberry Pi Pico because there is not a single standard for which pair of pins are the "default" I2C pins on the Pico.

So instead do:

Code: Select all

i2c = busio.I2C(board.the_pin_you_want_for_SCL, board.the_pin_you_want_for_SDA)
See https://learn.adafruit.com/getting-star ... es-3082902 for more information.

User avatar
milhousehouten
 
Posts: 2
Joined: Tue Jan 31, 2023 7:33 am

Re: Circuitpython and I2C challanges

Post by milhousehouten »

@danhalbert If you only knew how much time I have spent on this issue...
It works as I intended to now. You are a hero!

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”