Javadoc link

The pcf8574 i/o expander is a circuit that can be used to expand the number of digitai I/O pins that you can use. It can be used as input, output or a combination of both. The device is i2c enabled so you can connect to it either thru the i2c interface on the Arduino or connect it directly to the i2c GPIO pins on a Raspberry PI. They come in a few different formats. The one I have tested looks like this:

 

The i2c address can easily be changed with the small switches. Some devices has addresses between 0x20 and 0x27 alternatviley  0x38 thru 0x3F. 

This circuit can sink more current that it can source, so for example if you want to blink a LED, you should connect the anode to Vcc and the resistance between the cathode and the pin on pcf8574.  

---

Thought this service you can control too the audio amplifier Max9744.

It's similar to the pcf8574 in that it only writes a single byte
The volume is controlled by writing a value between 0 and 63

Example code (from branch develop):
#file : Pcf8574.py (github)
# Initiate the Arduino
arduino = runtime.start("arduino","Arduino")
arduino.connect("COM3")
# Select the Arduino as controller for the IO extender on bus 1 and i2c address 0x38
pcf = runtime.start("pcf","Pcf8574")
# From version 1.0.2316 use attach instead of setController
# pcf.setController(arduino,"1","0x38")
pcf.setBus("0")
pcf.setAddress("0x38")
pcf.attach(arduino,"0","0x38") # When using the Arduino, always use Bus 0, it doesn't have a bus 1
# Set four pins as output. 
pcf.pinMode(0,"OUTPUT")
pcf.pinMode(1,"OUTPUT")
pcf.pinMode(2,"OUTPUT")
pcf.pinMode(3,"OUTPUT")
# Blink a LED on pin 1
pcf.write(1,1)
sleep(1)
pcf.write(1,0)
sleep(1)
pcf.write(1,1)
sleep(1)
pcf.write(1,0)
sleep(1)
pcf.write(1,1)
# Set four pins as output. 
pcf.pinMode(4,"INPUT")
pcf.pinMode(5,"INPUT")
pcf.pinMode(6,"INPUT")
pcf.pinMode(7,"INPUT")
# Read and display digital input
print (pcf.read(4))
print (pcf.read(5))
print (pcf.read(6))
print (pcf.read(7))
 
# Script to change the volume of the Max9744
# https://github.com/MyRobotLab/pyrobotlab/blob/master/home/Mats/Max9744.py
# It's similar to the pcf8574 in that it only writes a single byte
# The volume is controlled by writing a value between 0 and 63
 
# volume = 16
# pcf.setController(arduino,"0","0x4B")
# pcf.writeRegister(volume)
Example configuration (from branch develop):
#file : Pcf8574.py (github)
!!org.myrobotlab.service.config.Pcf8574Config
address: '0x20'
bus: '1'
controller: null
listeners: null
peers: null
rateHz: 1.0
type: Pcf8574