API Reference

qwiic_led_stick

Python module for the SparkFun Qwiic LED Stick - APA102C.

This package is a port of the existing [SparkFun Qwiic LED Stick Arduino Library](https://github.com/sparkfun/SparkFun_Qwiic_LED_Stick_Arduino_Library).

This package can be used in conjunction with the overall [SparkFun Qwiic Python Package](https://github.com/sparkfun/Qwiic_Py).

New to qwiic? Take a look at the entire [SparkFun Qwiic Ecoststem](https://www.sparkfun.com/qwiic).

class qwiic_led_stick.QwiicLEDStick(address=None, i2c_driver=None)[source]
Parameters
  • address – The I2C address to use for the device. If not provided, the default address is used.

  • i2c_driver – An existing i2c driver object. If not provided a a driver is created.

Returns

The GPIO device object.

Return type

Object

LED_off()[source]

Turn all LEDs off by setting color to 0

Returns

true if the command was sent successfully, false otherwise.

Return type

bool

begin()[source]

Initialize the operation of the Qwiic LED Stick. Run is_connected()

Returns

Returns true if an LED Stick is connected to the system False otherwise.

Return type

bool

change_address(new_address)[source]

Change the I2C address from one address to another.

Parameters

new_address – the new address to be set to. Must be valid.

Returns

Nothing

Return type

Void

change_length(new_length)[source]

Change the length of the LED string

Parameters

new_length – the new length of the LED string

Returns

true if the command was sent successfully, false otherwise.

Return type

bool

is_connected()[source]

Determine if a Qwiic SGP40 device is connected to the system.

Returns

True if the device is connected, false otherwise.

Return type

bool

set_all_LED_brightness(brightness)[source]

Change the brightness of all LEDs while keeping their current color. To turn all LEDs off but remember their previous color, set brightness to 0

Parameters

brightness – value of LED brightness between 0 and 31.

Returns

true if the command was sent successfully, false otherwise.

Return type

bool

set_all_LED_color(red, green, blue)[source]

Set the color of all LEDs in the string. Each will be shining the same color. The color value must be between 0-255.

Parameters
  • red – the red value to set all LEDs to. Between 0 and 255.

  • green – the green value to set all LEDs to. Between 0 and 255.

  • blue – the blue value to set all the LEDs to. Between 0 and 255.

Returns

Returns true if command is written successfully, false otherwise

Return type

bool

set_all_LED_unique_color(red_list, green_list, blue_list, length)[source]

Change the color of all LEDs at once to individual values.

Parameters
  • red_list – a list of red values for the LEDs. Index 0 of red_list corresponds to the red value of LED 0.

  • blue_list – a list of blue values for the LEDs.

  • green_list – a list of green values for the LEDs.

  • length – the length of the LED string.

Returns

True if commands are written successfully, false otherwise

Return type

bool

set_single_LED_brightness(number, brightness)[source]

Change the brightness of a specific LED while keeping their current color. To turn LEDs off but remember their previous color, set brightness to 0.

Parameters
  • number – number of LED to change brightness. LEDs indexed starting at 1.

  • brightness – value of LED brightness between 0 and 31.

Returns

true if the command was sent successfully, false otherwise.

Return type

bool

set_single_LED_color(number, red, green, blue)[source]

Change the color of a specific LED.

Parameters
  • number – the number of LED. Indexing starts at 1.

  • red – the red value between 0 and 255

  • green – the green value between 0 and 255

  • blue – the blue value between 0 and 255

Returns

Returns true if command written successfully, false otherwise

Return type

bool