PU2CLR PCF8574 Arduino Library  1.0.3
Arduino Library for PCF8574 Device - By Ricardo Lima Caratti
PCF8574 basic functions

It is a Library to control the PCF8574 device. More...

Functions

void PCF::setClock (long freq)
 Sets I2C bus to a given frequency. More...
 
uint8_t PCF::lookForDevice ()
 Look for PCF8574 device I2C Address. More...
 
void PCF::setup (uint8_t i2c=DEFAULT_I2C_ADDRESS)
 Starts the PCF8574. More...
 

Detailed Description

It is a Library to control the PCF8574 device.

This library was built based on the Datasheet "PCF8574 8-Bit I/O Expander with Serial Interface" from Microchip

The PCF8574 device provides 8-bit, general purpose, parallel I/O expansion. It can be controlled via I²C bus applications. It is a great and inexpensive device that allow you to add more peripherals to be controlled by your Arduino board via I²C protocol.

Some Arduino projects may require more pins than the Arduino actually has. In these cases, you can use up to 8 PCF8574 devices using only the I²C bus (two Arduino pins) and add up to 64 input / output ports to your project.

This library can be freely distributed using the MIT Free Software model.

This library uses the I²C communication protocol and implements most important functions offered by PCF8574 device from MicroChip. It also has primitive functions that make it easier to implement commands that may not have been implemented yet. The main features implemented can be seen below:

1) GPIO individual control (8 I/O pins)

2) I²C address customization

Author
Ricardo LIma Caratti (pu2cl.nosp@m.r@gm.nosp@m.ail.c.nosp@m.om)
Date
2021-01-20

Function Documentation

◆ setClock()

void PCF::setClock ( long  freq)
inline

Sets I2C bus to a given frequency.

50000 = 50kHz; 100000 = 100kHz; etc

Plese check the property I2C bus frequency/speed of your board

◆ lookForDevice()

uint8_t PCF::lookForDevice ( )

Look for PCF8574 device I2C Address.

This method will look for a valid PCF8574 device adress between 0x20 and 0x27

Returns
uint8_t the I2C address of the first PCF8574 device connect in the I2C bus

◆ setup()

void PCF::setup ( uint8_t  i2c = DEFAULT_I2C_ADDRESS)

Starts the PCF8574.

Starts the PCF8574 and sets the default values.

Parameters
i2cI2C address
reset_pinif you want to control the reset, select an Arduino pin to do that.