- Thu Jan 01, 2009 8:16 pm
#62450
Hiya,
I recently purchased some Mini PCF8574 boards from a company called Futurlec.
I have successfully got the board talking I2C and would like to offer this very simple Arduino Sketch in the hope that it helps someone get their system working quicker.
For testing you need to connect from the [V] pin on the output header to a resistor {I used 560 ohm} then to your LED anode, tie LED cathode to pin [0] {or whatever pin you want to use to test}.
Hope it helps someone..
Enjoy
I recently purchased some Mini PCF8574 boards from a company called Futurlec.
I have successfully got the board talking I2C and would like to offer this very simple Arduino Sketch in the hope that it helps someone get their system working quicker.
For testing you need to connect from the [V] pin on the output header to a resistor {I used 560 ohm} then to your LED anode, tie LED cathode to pin [0] {or whatever pin you want to use to test}.
Hope it helps someone..
Enjoy
Code: Select all
/*
Test program for PCF8574A I2C I/O expander from Futurlec
- Blinks all pins low then high - 1 second cycle.
by pclyne
*/
#include <Wire.h>
#define CARD_ADR B0111000 //PCF8574A chips are of address format 0111 [a1] [a2] [a3]
// Address with three address pins grounded. = 0111000
// Note that the R/W bit is not part of this addressas the wire library takes care of the LSB
void setup() {
Wire.begin();
Serial.begin(57600);
}
void loop() {
//Turn all pins off
Serial.println("Write B00000000.");
CardWrite(B00000000);
delay(1000);
//Turn them back on
Serial.println("Write B11111111.");
CardWrite(B11111111);
delay(1000);
}
void CardWrite(byte txdata) {
Wire.beginTransmission(CARD_ADR);
Wire.send(txdata);
Wire.endTransmission();
}