Go Down

Topic: Class for I2C PCF8574 IO Expander (Read 768 times) previous topic - next topic

robtillaart

Today I posted my PCF8574 lib on the playground - http://playground.arduino.cc//Main/PCF8574Class -

The PCF8574 class has the following functionality
  • read8 and write8 (all pins) - these do the actual I2C IO
  • read and write (1 pin),
  • toggle(pin),
  • leftShift(n) and rightShift(n),
  • value() - returns the last value read.
  • lastError() - returns the last I2C error code. (0 ==> OK)

    As always, comments and remarks are welcome.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

4fuss

#1
Oct 28, 2014, 09:11 pm Last Edit: Oct 28, 2014, 09:25 pm by 4fuss
Hi Rob,
I'm playing with PCF8574 using your class. I want to blink three leds in order one by one; one blink for each: from dark to light to dark again in a loop. And I have a problem with this, because at first all three leds gets light one by one and after that they start to blink - but the blinking is inverse, that means from light to dark to light again.

Are the pins somehow activated (turned HIHG) before they can be used?

After a while I figured out that when I use function write(i, 0), the led on i PIN lights up, and when I use write(i, 1), the i led balckout. Why is it?

robtillaart

Can you post the code you use? (please use code tage - 2nd icon from the right)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up