IO Abstraction library fully supports the AW9523 16-bit IO expander chips on Arduino and mbed. It requires only two pins (three for interrupt mode) SDA, SCL, and optionally INT. Our driver integrates the GPIO, LED controller, and interrupt support providing nearly all functions using familiar Arduino terminology.
This device can even be used in conjunction with an AW9523 analog device to make it even easier to use the LED controller.
The AW9523 is a pretty complete device, and has most capabilities of Arduino pins, however there are several notes:
AnalogDevice
abstraction that you can use, any pin can be turned into a current source.To use globally define a variable as follows:
AW9523IoAbstraction ioDevice(0x58, IO_PIN_NOT_DEFINED);
Optionally you can create an AnalogDevice
to access the LED controller features:
AW9523AnalogAbstraction ledController(ioDevice);
This will allow you to treat the extra LED controller features available as an analog device. See the analog device help. Also see the AW9523 example packaged with the library, or the AW9523 I2C device reference docs.
Once you have created an instance, simply use it like any other IoAbstraction they all work the same way.
To find your i2c device address use this i2c address scanner, this sketch will tell you every address on which it finds an i2c chip.
If you want to use the LED control function of the device, there is an additional output type, it is LED_CURRENT_OUTPUT
. You can enable the LED mode two ways.
ioAW9523.pinMode(pin, LED_CURRENT_OUTPUT);
analogAw9523.initPin(pin, DIR_PWM);
See the reference docs linked above or example for more information.