Skip to content

Commit 874545d

Browse files
authored
Merge pull request #55 from DJDevon3/WorkingBranch
Update import and initializations to current standards
2 parents f2dd719 + fcf077a commit 874545d

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed

examples/pca9685_calibration.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,15 @@
77
# speed.
88

99
import time
10-
11-
from board import SCL, SDA
12-
import busio
13-
14-
# Import the PCA9685 module.
10+
import board
1511
from adafruit_pca9685 import PCA9685
1612

1713
# 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
1916

2017
# Create a simple PCA9685 class instance.
21-
pca = PCA9685(i2c_bus)
18+
pca = PCA9685(i2c)
2219

2320
# Set the PWM frequency to 100hz.
2421
pca.frequency = 100

examples/pca9685_servo.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
# SPDX-License-Identifier: MIT
33

44
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
116
from adafruit_motor import servo
127
from adafruit_pca9685 import PCA9685
138

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
1511

1612
# Create a simple PCA9685 class instance.
1713
pca = PCA9685(i2c)

examples/pca9685_simpletest.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
22
# SPDX-License-Identifier: MIT
33

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.
67

7-
from board import SCL, SDA
8-
import busio
9-
10-
# Import the PCA9685 module.
8+
import board
119
from adafruit_pca9685 import PCA9685
1210

1311
# 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
1514

1615
# Create a simple PCA9685 class instance.
17-
pca = PCA9685(i2c_bus)
16+
pca = PCA9685(i2c)
1817

1918
# Set the PWM frequency to 60hz.
2019
pca.frequency = 60

0 commit comments

Comments
 (0)