I would like to ask a question regarding the usage of secondary channel of i2c in rpi 4b. I have enabled the secondary channel through adding "dtoverlay=i2c-gpio,bus=2,i2c_gpio_sda=22,i2c_gpio_scl=23" in the "config.txt" file. Thus, I was able to attain the address "0x40" by typing in "i2cdetect -y 2" in the terminal of my rapsberry pi 4b. However when I run my python code, it states an error which "no i2c device found at address 0x40." I tried to debug the program and it is the problem with the "busio" module. The strange thing is that when I connect it to the primary i2c channel, it works, however, if I connect it to my secondary channel the program doesn't work. It would be so much appreciated if anyone can help me solving up this issue.
My code was:
import time import board import busio from adafruit_pca9685 import PCA9685 from adafruit_motor import servo i2c = busio.I2C(board.SCL, board.SDA) pca = PCA9685(i2c, address=0x40) pca.frequency = 50 servo_motor = servo.Servo(pca.channels) while True: servo_motor.angle = 0 time.sleep(1) servo_motor.angle = 90 time.sleep(1) servo_motor.angle = 180 time.sleep(1)