New LiquidCrystal library - LCD library

bperrybap, you are a lifesaver with those clear examples!

I have been playing with this for the last hour and a half and getting increasingly frustrated, but not wanting to come back here and ask further until exhausting my own efforts in consulting the library files.

Anyway, I was just about to post and I saw yours and it made everything clear.

I found the full constructor for ADDR, EN, RW, RS, D4, D5, D6, D7, Backlight, POLARITY and used this for the example sketch.

I also found the reference to setBacklightPin(BacklightPin, POLARITY) and the setBacklight(0-255) and thus set this too.

I was getting nothing!

Why?

Because I was using the 8574 pin numbers in the constructor:-

LiquidCrystal_I2C lcd(0x27, 9, 10, 11, 4, 5, 6, 7, 12, POSITIVE); // addr, EN, RW, RS, D4, D5, D6, D7, BacklightPin, POLARITY
  lcd.setBacklightPin(12, POSITIVE);
  lcd.setBacklight(1);

Your clear examples said to use the BIT NUMBER! Thus I changed to:-

LiquidCrystal_I2C lcd(0x27, 4, 5, 6, 0, 1, 2, 3, 7, POSITIVE); // addr, EN, RW, RS, D4, D5, D6, D7, BacklightPin, POLARITY
  lcd.setBacklightPin(7, POSITIVE);
  lcd.setBacklight(1);

This got me most of the way but the backlight wasn't working correctly.

I was taking the POSITIVE or NEGATIVE to be the style of LCD but, of course, it's referring to whether backlight is set with a HIGH or LOW.

My backpacks have PNP transistors controlling the backlight so the BL is on when LOW or nothing on the transistor base. Pull the base low and the transistor turns off and BL is off.

So, a final change to:-

LiquidCrystal_I2C lcd(0x27, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE); // addr, EN, RW, RS, D4, D5, D6, D7, BacklightPin, POLARITY
  lcd.setBacklightPin(7, NEGATIVE);
  lcd.setBacklight(1);

And.....VOILA! Everything working as it should.

I totally agree that the examples need to be clearer. Certainly that reference to BacklightPin is very confusing, as when using the I2C it is actually BacklighBit. I totally understand it is a common setting across all the different connection methods but it is misleading if you haven't got a clear example showing the connection Bits that each LCD line is controlled by on the 8574 IC.

Anyway, happy now that I can use this new library with my projects and with different hardware connection methods. I may well play with the Shift Register method as some SR backpacks would be less expensive than equivalent 8574 versions to have made. I just need to consider any overhead in processor cycles and speed vs the cost saving.

Many thanks again. I'm off to try the MENWIZ library now this is working. :wink: