Qwiic LED Stick - APA102C Hookup Guide

Pages
Contributors: El Duderino, MAKIN-STUFF
Favorited Favorite 1

Qwiic LED Stick Arduino Library

Note: This library assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

The SparkFun Qwiic LED Stick Arduino Library makes controlling the LED stick as easy as sending the command setLEDColor() with three RGB values to set the color along with a host of other functions to control the LED Stick. Install the library by searching for "SparkFun Qwiic LED Stick" in the Arduino Library manager. Users who prefer to manually install it can get the library from the GitHub Repository or download the ZIP by clicking the button below:

Library Functions

The list below outlines all the functions available in the Qwiic LED Stick library along with quick descriptions of what they do.

Class

Construct the LED object in the global scope. The examples use LEDStick as the Qwiic LED Stick object.

  • LED LEDStick;

Device Setup and Settings

  • bool begin(uint8_t address, TwoWire &wirePort); - Initialize the LED Stick at a specified address on a chosen port. If left empty, default address will be used and Wire is used.
  • bool isConnected(); - Check if the LED Stick is connected to the port at the specified address.

LED Control

  • bool setLEDColor(uint8_t number, uint8_t red, uint8_t green, uint8_t blue); - Sets the color of the selected LED using RGB values between 0 and 255. If no LED is selected, all LEDs are set to the specified color. For example, to set the fourth LED to yellow the command would be LEDStick.setLEDColor(4, 0, 255, 255);.
  • bool setLEDBrightness(uint8_t number, uint8_t brightness); - Sets the brightness of the selected LED. If no LED is selected, all LEDs are adjusted. Acceptable values are 0 to 31. Setting an LED to 0 will turn it off but saves the stored color value.
  • bool LEDOff(void); - Sets all LEDs in the Qwiic LED Stick to off.
  • bool changeAddress(uint8_t newAddress); - Change the I2C address of the ATTiny85. Enter a valid address. Note once the address is changed, the LED Stick must be initialized with the new address. For example, initialize a Qwiic LED Stick with the address 0x70 using LEDStick.begin(0x70);.
  • bool changeLength(uint8_t newLengths); - Change the number of LEDs in the chain. Used when adding another Qwiic LED Stick or other addressable LED strip to the circuit. Default value is 10. Max value is 100.