Previous versions of this worked. But now, there is no motor control.
I have verified that the adafruit PCA9685 is wired correctly and can be detected by i2cdetect; below is the output and the board address is 0x40
Code: Select all
~/test/libs$ i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
I then test the i2c to ensure it also sees the PCA9685 board. The output verifies that i2c can see the PCA9685 because 0x40 is decimal 64.
Code: Select all
~/test/libs$ python3
Python 3.7.13 (default, Apr 24 2022, 01:04:09)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
> import board
> >>> import busio
> >>> dir(board)
> ['CE0', 'CE0_1', 'CE1', 'CE1_1', 'D10', 'D11', 'D12', 'D13', 'D16', 'D17', 'D18', 'D19', 'D20', 'D21', 'D22', 'D23', 'D24', 'D25', 'D26', 'D27', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'I2C', 'MISO', 'MISO_1', 'MOSI', 'MOSI_1', 'SCK', 'SCK_1', 'SCL', 'SCLK', 'SCLK_1', 'SCL_1', 'SDA', 'SDA_1', 'SPI', '__blinka__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__repo__', '__spec__', '__version__', 'ap_board', 'board_id', 'detector', 'pin', 'sys']
> >>> from board import SDA,SCL,SDA_1,SCL_1
> >>> i2c_0= busio.I2C(SCL,SDA)
> >>> print(i2c_0.scan())
> [64, 72, 105, 112]
> >>> i2c_1=busio.I2C(SCL_1,SDA_1)
> >>> print(i2c_1.scan())
> [56]
Code: Select all
Now I load the adafruit pca9685 driver and set the speed to 0.
>>> import adafruit_pca9685
> >>> pca = adafruit_pca9685.PCA9685(i2c_0)
> >>> pca.frequency = 1500
> >>> right_motor_speed = pca.channels[1]
> right_motor_speed.duty_cycle = 0