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

i2c not working properly unless I import wifi and set a small delay while initializing the i2c variable (See Video) #4472

Closed
eddieespinal opened this issue Mar 24, 2021 · 4 comments
Labels

Comments

@eddieespinal
Copy link

Firmware

Adafruit CircuitPython 6.2.0-beta.1-dirty on 2021-03-22;

Code/REPL

import time
import board
import busio
import wifi # without this import, i2c won't work
import adafruit_mpu6050

i2c = busio.I2C(board.SCL, board.SDA)
time.sleep(1) # without this delay, i2c won't work
mpu = adafruit_mpu6050.MPU6050(i2c, address=0x69)

while True:
    print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (mpu.acceleration))
    print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (mpu.gyro))
    print("Temperature: %.2f C" % mpu.temperature)
    print("")
    time.sleep(1)

Behavior

code.py output:
Traceback (most recent call last):
  File "code.py", line 9, in <module>
  File "adafruit_mpu6050.py", line 144, in __init__
ValueError: No I2C device at address: 69

Description

  • Error while using i2c with any i2c devices or sensors.
  • Only happens when I don't include the import wifi and set a delay while initializing the i2c variable.

I tried using other i2c devices such as 128x64 display, same error same solution to make it work.

Additional Info

Here is a video that shows what I'm describing here.

Adding the import wifi and time.sleep(1) solves the issue.

@dhalbert
Copy link
Collaborator

Please try 6.2.0-beta.4. We added, #4387, which may well fix this problem. That PR was mistakenly omitted from the release notes for beta.4 -- I will fix that.

@eddieespinal
Copy link
Author

Thank you @dhalbert! - I will update it now and test this again.

@eddieespinal
Copy link
Author

Hi @dhalbert, I just updated to beta.4 and the issue is now fixed!. Thank you again for your hard work and for replying so fast. This ticket can be closed.

@dhalbert
Copy link
Collaborator

Glad it works for you as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants