File tree Expand file tree Collapse file tree 3 files changed +12
-17
lines changed Expand file tree Collapse file tree 3 files changed +12
-17
lines changed Original file line number Diff line number Diff line change 7
7
# speed.
8
8
9
9
import time
10
-
11
- from board import SCL , SDA
10
+ import board
12
11
import busio
13
-
14
- # Import the PCA9685 module.
15
12
from adafruit_pca9685 import PCA9685
16
13
17
14
# Create the I2C bus interface.
18
- i2c_bus = busio .I2C (SCL , SDA )
15
+ i2c = board .I2C () # uses board.SCL and board.SDA
16
+ # i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040
19
17
20
18
# Create a simple PCA9685 class instance.
21
- pca = PCA9685 (i2c_bus )
19
+ pca = PCA9685 (i2c )
22
20
23
21
# Set the PWM frequency to 100hz.
24
22
pca .frequency = 100
Original file line number Diff line number Diff line change 2
2
# SPDX-License-Identifier: MIT
3
3
4
4
import time
5
-
6
- from board import SCL , SDA
5
+ import board
7
6
import busio
8
-
9
- # Import the PCA9685 module. Available in the bundle and here:
10
- # https://github.com/adafruit/Adafruit_CircuitPython_PCA9685
11
7
from adafruit_motor import servo
12
8
from adafruit_pca9685 import PCA9685
13
9
14
- i2c = busio .I2C (SCL , SDA )
10
+ i2c = board .I2C () # uses board.SCL and board.SDA
11
+ # i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040
15
12
16
13
# Create a simple PCA9685 class instance.
17
14
pca = PCA9685 (i2c )
Original file line number Diff line number Diff line change 4
4
# This simple test outputs a 50% duty cycle PWM single on the 0th channel. Connect an LED and
5
5
# resistor in series to the pin to visualize duty cycle changes and its impact on brightness.
6
6
7
- from board import SCL , SDA
7
+ import time
8
+ import board
8
9
import busio
9
-
10
- # Import the PCA9685 module.
11
10
from adafruit_pca9685 import PCA9685
12
11
13
12
# Create the I2C bus interface.
14
- i2c_bus = busio .I2C (SCL , SDA )
13
+ i2c = board .I2C () # uses board.SCL and board.SDA
14
+ # i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040
15
15
16
16
# Create a simple PCA9685 class instance.
17
- pca = PCA9685 (i2c_bus )
17
+ pca = PCA9685 (i2c )
18
18
19
19
# Set the PWM frequency to 60hz.
20
20
pca .frequency = 60
You can’t perform that action at this time.
0 commit comments