The last thing that took me long time to figure out is that the backlit pot ....
Just a a clarification. The pot does not control the backlight or its brightness.
The backlight is fixed at a constant brightness.
The pot controls the contrast. Since contrast controls how much light is blocked by pixels,
it will appear to control the brightness of the pixels on inverted displays.
But in reality is is not affecting the backlight brightness or its power consumption.
If your LCD connections are (Left to Right) - VSS, VDD, VO, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, A (or LED+), K (or LED-) then the connection goes to the following bits on the I2C chip
RS - 6
RW - 5
E - 4
D4 - 0
D5 - 1
D6 - 2
D7 - 3
Backlight - 7
This makes your constructor 4,5,6,0,1,2,3,7 so use the following example sketch:-
The order of the LCD pinout connections on the LCD module has no bearing on the bit numbers used in the
lcd library constructor.
Almost all hd44780 based LCD modules will use that same 16 pin pinout -
some move things around for the A and K connections since those are
technically not part of hd44780.
When the I2c backpack is designed, the connections between the i2c chip outputs
and the LCD module are created for a fixed LCD module pinout.
All the i2c backpacks I've seen, use that standard 16 pin LCD pinout - but they all are not wired
up the same between the LCD and the PCF8574 and hence require different constructors.
The bit numbers used in the constructor is based on how the PCF8574 i2c chip's
output port is wired up to the LCD module connections.
The wiring is done in etch on the PCB.
Yes there is more than one wiring used on these types of i2c boards.
While most of the "mjkdz" ones out there seem to have wired them up the same,
the only way to really know for sure is to look at the traces on the i2c board
between the PCF8574 chip and the LCD module to see how they wired up
the PCF8574 output port bits.
tack's constructor bits will more than likely work for your i2c backpack.
The other thing to watch out for is the i2c address.
This is because there are several different 8574 chips used and they each have different default base addresses.
Complicating matters, the chips can be strapped for a range of addresses starting at the base address.
Different vendors strap them differently so even though the wiring may be the same and the chip
is the same, the address may be different since the chip has been strapped to not use the default address.
The best thing to do is what creatrope said, go get the i2cscanner sketch.
run it to see what i2c address is used. That way you won't be fighting an
issue due to an incorrect address.
Another thing about these i2c boards, is that they don't have the required i2c pullups on them.
(almost none of them do - not just the lower cost ones)
While they seem to work without them, pullups are required for proper operation
particularly if using more than one i2c device.
If you do a search for mjkdz you will see that there have been several threads recently about
how to set up the constructor for this type of i2c backpack that you might find useful
in trying to gain knowledge and technical expertise about these types of boards.