Greetings,
Using the LiquidCrystal_I2C library, I use pins A4 and A5 as I read in some documentation. I don't see anywhere I can change the pins I use?
Thank you! ✌️
It might be useful to explain why you need to change these pins, because the correct solution may not be changing pins. A4 and A5 are the hardware I2C pins.
Using the LiquidCrystal_I2C library, I use pins A4 and A5 as I read in some documentation. I don't see anywhere I can change the pins I use?
And there is a
very good reason for that.
But you pose the archetypal "newbie" "XY Problem (http://xyproblem.info/)". :smiley-roll:
https://www.youtube.com/watch?v=xVC0X_PE_XE&t=288s
if you are using an UNO there are separate SDA & SCL pins which do the same thing, but things got twitchy when I used A4 & A5 as digital inputs. so your choice is I2C and 4 Analog pins no I2C and 6 Analog pins.
https://www.youtube.com/watch?v=xVC0X_PE_XE&t=288s (https://www.youtube.com/watch?v=xVC0X_PE_XE&t=288s)
That's a bit dated - bperrybap's HD44780 library installed intrinsically from the IDE library manager is substantially enhanced.
Hello,
It works with the I2C module connected to the LCD screen. But not with all of the Digital Pins obviously...
Instead of LiquidCrystal.h, try this one :
<LiquidCrystal_I2C.h>
with this library
<Wire.h>
And
Wire.begin(D6,D3); // SDA > D6 | SCL > D3 >>>CHANGE FOR YOUR PINS CONFIGURATION.<<<
IF IT DOESN'T WORK TRY TO SWITCH TO SCL > D6 | SDA > D3... ( I observed differences with NODEMCU V2 & V3...
Like this :
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // CHANGE the "0x27" ADRESS FOR YOUR SCREEN CONFIGURATION
void setup()
{
Wire.begin(D6, D3); // SCL > D3 | SDA > D6 | IF IT DOESN'T WORK TRY TO SWITCH TO SCL > D6 | SDA > D3... ( I observed differences with NODEMCU V2 & V3...
lcd.init(); // initialize the lcd
lcd.clear();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("IT WORKS ! :D");
}
void loop()
{
}
I would again refer you - or anyone else - to Bill Perry's "HD44780" library which should be installed specifically using the IDE library manager, not from a 'net source.
This installs a plethora of examples which allow you to either determine the exact configuration of the particular "backpack" or simply to allow his code in the vast majority of cases, to determine it and use it with no prior configuration.