Simple test¶
Ensure your device works with this simple test.
examples/is31fl3236a_simpletest.py¶
1# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
3# SPDX-FileCopyrightText: Copyright (c) 2021 Randy Glenn
4# SPDX-License-Identifier: MIT
5
6# This simple test outputs a 50% duty cycle PWM signal on channel 0. Connect an LED
7# cathode to the pin, and the LED's anode to the supply voltage, to see duty cycle /
8# brightness changes.
9
10from board import SCL, SDA
11import busio
12
13# Import the IS31FL3236A module
14from is31fl3236a import IS31FL3236A
15
16# Create the I2C bus interface
17i2c_bus = busio.I2C(SCL, SDA)
18
19# Create a simple IS31FL3236A class instance
20is31fl = IS31FL3236A(i2c_bus)
21
22# PWM frequency is 3 KHz by default, which should be fine
23
24# Set the PWM duty cycle for channel 0 to 50%. duty_cycle is 16 bits to match other PWM objects,
25# but the IS31FL3236A will only actually give 8 bits of resolution.
26is31fl.channels[0].duty_cycle = 0x7FFF