Hello guys, I'm pretty new with Arduino and Electronics in general, so please forgive me if this is a common or easy (or even dumb) question, but I simply can't figure out why this is happening.
What I'm trying to do should be very easy, I'm trying to expand the I/O ports of the Arduino, I've found out this
tutorial, since the PCF8574 is fairly cheap and easily available where I live, I decided to give it a try.
Well, I've got no luck on lighting up the LEDs, and after fiddling around with the Wire Library, I've managed to get....something. The LEDs were flashing, however in a completely random way. What I did was to create a loop and sending the write signal on it, something like this:
Also, the LEDs were very, very dim. After looking a little more, I've realized they were all lit, and I was actually turning one or another off! That made no sense to me. I've attached the negative end of the LED on the GND and the positive to the ports of the PCF8574P, it should be like this right?
Anyway, afterward I've found this
tutorial, and in it, it's actually connecting the LED directly to the 5V (with the resistor in between) and the negative on the PCF8574P, then in the program he negates the address he's writing (~0x01, instead of 0x01 for example), that made no sense to me, but it worked like a charm. Now, can anyone please explain me why? I've attached the Fritzing sketch so you can see how the connections were made.
Also, you can find the datasheet here
Thanks for the help!