PCF8574 I2C IO Expander
This is an I2C 8 bit IO expander, which you can add up to 8 of to a single I2C bus.
Commonly used for interfacing to Mindstorms :
Hardware
|
|
Software
Right-click the project to import to, select "Import Library..." and use the following details:
- Library SVN URL: http://mbed.org/projects/cookbook/svn/PCF8574/trunk
- Library Name: PCF8574
| PCF8574 | Abstraction for the popular I2C 8 Bit IO expander |
| Functions | |
| PCF8574 | Create an instance of the PCF8574 connected to specfied I2C pins, with the specified address. |
| read | Read the IO pin level |
| write | Write the IO pin levels |
Create an instance of the PCF8574 connected to specfied I2C pins, with the specified address.
PCF8574 ( PinName sda, PinName scl, int addr )
Read the IO pin level
int read ( void )
Write the IO pin levels
void write ( int data )
View the library
Hello World!
|
|
| Schematic | Photo |
#include "mbed.h" #include "PCF8574.h" PCF8574 io(p9,p10,0x20); int main(){ // Spin in a loop toggling the PCF8574pins while(1) { io.write(0x0); wait(0.2); io.write(0xf); wait(0.2); } } | LPC1768_PCF8574.bin LPC2368_PCF8574.bin |
| Source Code | Binary |
Resources
Datasheet
