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