i'm having few PCF8574P which i want to use with my arduino and multiplex them however i have no idea how to use the I2C BUS and the IC in general. There are few libraries but they're fairly complex. Is there any library which makes writing and reading from the PCF8574P easy?
1 Answer
Have you given Rob Tillaart's library from the Arduino Playground a try? The demo sketch might look a bit overwhelming, but at it's simplest, all your sketch should need to have to make a led blink like the standard arduino 'blink' sketch is
#include "PCF8574.h"
#include <Wire.h>
// adjust addresses if needed
PCF8574 PCF_38(0x38); // add led to P0 (pin 4) (used as output)
void setup()
{
//your setup code here
}
void loop()
{
//turn P0 (pin 4) of the I/O expander on and off once a second
PCF_38.write(0, 1);
delay(1000);
PCF_38.write(0, 0);
delay(1000);
}
I don't have any of these parts handy so I can only give generic advice.
-
This is good..simple code to blink one led. It works..I like it. Cheers...Markus– MarkusOct 1, 2017 at 8:35