Having trouble seeing the detail in this mess of jumper wires? Click on the photo for a larger view!
With the Qwiic GPIO circuit assembled and connected to your microcontroller it's time to get some code uploaded
and start controlling the extra I/O pins via I C!
Qwiic GPIO 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 GPIO Arduino Library helps to make interfacing between the TCA9534 and your Arduino
microcontroller simple. In this section we'll list all of the functions available in the library as well as brief
descriptions about what they do.
Library Functions
We've outlined all the functions in the Arduino library below along with some quick descriptions of what they do.
The examples cover nearly all of the functions so you may want to refer to those for help with writing your own
code using them.
Device Setup & Settings
bool begin(TwoWire &wirePort, uint8_t address);
set the TCA9534 to an alternate I C address using the ADR jumpers, enter that here.
bool pinMode(uint8_t gpioNumber, bool mode);
TCA9534. For example,
power up.
bool pinMode(bool *gpioPinMode);
or output. This accepts a bool defined in your setup to set all eight GPIO pins at once. Refer to Example1B -
Write_GPIO_Port for more information on using this function.
bool invertPin(uint8_t gpioNumber, bool inversionMode);
on the TCA9534.
bool invertPin(bool *inversionMode);
Example 3B - Inversion_Port for a demonstration of how to set up and use this function.
GPIO Reading and Writing
bool digitalWrite(uint8_t gpioNumber, bool value);
selected GPIO pin either
2
2
pinMode(0, GPIO_OUT);
- An alternative to the above function to set the entire port as an input
- Invert the polarity of the entire port of the TCA9534. Refer to
or
.
HIGH
LOW
- Initialize the TCA9534 on the I C bus. If you have
- Sets the mode of the selected GPIO pin on the
sets pin 0 as an output. All I/O's default to Inputs on
- Invert the polarity of the selected GPIO pin
- Your basic Digital Write function. Write to the
2
Need help?
Do you have a question about the Qwiic GPIO and is the answer not in the manual?
Questions and answers