Created
June 29, 2022 09:37
-
-
Save rtyley/5bf3564ba6f10f9fadb4f21c277848fe to your computer and use it in GitHub Desktop.
Testing `constant_current_range` in https://github.com/adafruit/Adafruit_CircuitPython_AW9523/pull/6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import board | |
import adafruit_aw9523 # LED driver | |
from time import sleep | |
i2c = board.I2C() | |
aw = adafruit_aw9523.AW9523(i2c) | |
aw.constant_current_range = adafruit_aw9523.AW9523_2_4_RANGE | |
aw.LED_modes = 0xFFFF | |
aw.directions = 0xFFFF | |
sleep(3) | |
while True: | |
for level in [1, 2, 128, 255]: | |
print(f"level = {level}") | |
for rangeId in [adafruit_aw9523.AW9523_4_4_RANGE,adafruit_aw9523.AW9523_3_4_RANGE,adafruit_aw9523.AW9523_2_4_RANGE,adafruit_aw9523.AW9523_1_4_RANGE]: | |
aw.constant_current_range = rangeId | |
aw.set_constant_current(1, level) # setting `constant_current_range` only takes effect after this is called. | |
print(f"constant_current_range = {rangeId}") | |
sleep(4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment