Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update import and initializations to current standards #55

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions examples/pca9685_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@
# speed.

import time

from board import SCL, SDA
import busio

# Import the PCA9685 module.
import board
from adafruit_pca9685 import PCA9685

# Create the I2C bus interface.
i2c_bus = busio.I2C(SCL, SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040

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

# Set the PWM frequency to 100hz.
pca.frequency = 100
Expand Down
10 changes: 3 additions & 7 deletions examples/pca9685_servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
# SPDX-License-Identifier: MIT

import time

from board import SCL, SDA
import busio

# Import the PCA9685 module. Available in the bundle and here:
# https://github.com/adafruit/Adafruit_CircuitPython_PCA9685
import board
from adafruit_motor import servo
from adafruit_pca9685 import PCA9685

i2c = busio.I2C(SCL, SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040

# Create a simple PCA9685 class instance.
pca = PCA9685(i2c)
Expand Down
15 changes: 7 additions & 8 deletions examples/pca9685_simpletest.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# This simple test outputs a 50% duty cycle PWM single on the 0th channel. Connect an LED and
# resistor in series to the pin to visualize duty cycle changes and its impact on brightness.
# Outputs a 50% duty cycle PWM single on the 0th channel.
# Connect an LED and resistor in series to the pin
# to visualize duty cycle changes and its impact on brightness.

from board import SCL, SDA
import busio

# Import the PCA9685 module.
import board
from adafruit_pca9685 import PCA9685

# Create the I2C bus interface.
i2c_bus = busio.I2C(SCL, SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040

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

# Set the PWM frequency to 60hz.
pca.frequency = 60
Expand Down