Clone wiki

New LiquidCrystal / I2CIO

I2CIO Arduino Library

The PCF8574 is an IO expander for two-line I2C bus. The PCF8574A provides general-purpose remote I/O expansion for most microcontroller families via the I2C interface [serial clock (SCL), serial data (SDA)].

Two main versions are available: the PCF8574 and the PCF8574A.

The only difference between the two is the I2C base address. The base address for the PCF8574 is 0x20 and the base address for the PCF8574A is 0x38. The library doesn't make any assumption as to the device being used, and it is up to the user to configure it during initialization of the application.

Example Code

The examples included with the library assumes the use of an PCF8574A set for address 0x38. It also assumes that the PCF8584A is mounted on an LCDI2CextraIO board with base address configured to 0x0 (i.e. configuration address jumpers set to (0, 0, 0)).

#include <I2CIO.h>

#define I2C_ADDR    0x38  // Define I2C Address where the PCF8574A is
I2CIO myPort;

void setup()
  myPort.begin ( I2C_ADDR );
  myPort.portMode ( OUTPUT ); // Define all pins as output on the port
  myPort.write ( 0x0 );       // Set all pins of the board to low


Source code for the library and documentation can be downloaded from the download section of this repository: here

The library comes in source and with examples that will get you started. Additionally you have a full description of the library in the docs folder in HTML format that you can browse.

To install the library please follow the instructions in Library Tutorial, there is a Section in the Tutorial indicating how to install a library.

The library is also included in the New LiquidCrystal library (LCD library).

This library has been tested with the I2CLCDextraIO board.


Lets keep this section very short.

New LiquidCrystal Library by F. Malpartida is licensed under of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version: GPL v3.0