I'm using advice I found on the internet but not using GitHub codes. Everybodies is different from what I've seen yet they all appear to designate the pins from the screens in the Setup.
Any advice?
#include <LiquidCrystal_I2C.h> #include <Wire.h>
//14 characters, and 2 lines
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// put your setup code here, to run once:
/*for set cursor the first number is columns
the second number is the rows
use lcd.print with input quotations for statements
*/
The code posted is for a 2-line LCD with I2C backpack (Google it).
A backpack is a port expander, so you need fewer wires to talk to the LCD.
So which LCD do you have. One with many wires, or one with added backpack.
Leo..
When using a display with an I2C backpack, it is common for the declaration of the LCD to include the pin mapping between the I2C interface and the display itself, because different manufactures will wire the connections differently. The libraries that use a simple declaration with only the I2C address and display dimensions are assuming a wiring configuration that is commonly used, and may or many not work with your display.
If you are having trouble with the display, install the HD44780 library in the IDE, and run the File > Examples > HD44780 > ioClass > hd44780_I2Cexp > I2CexpDiag sketch, that will search for any displays connected to the I2C bus, and determine how the I2C expander is wired to the display, displaying that information on the LCD and in the serial monitor.
The code is only one part of getting an LCD to work. You have to wire it correctly, you have to adjust the contrast correctly and you have to have the right code.
Until and unless you explain all of these details; which display it is , how you have wired it, how you have adjusted it and what code you have used (instructions here, point 7, for posting the code for review), most of us will simply and sensibly ignore your complaints.
Yes it can be problematic locating a working and maintained library for an hd44780 i2c lcd.
UART and I2C are totally different things.
Assuming you are using an hd44780 lcd with one of the common i2c PCF8574 i/o expander based backpacks, use the hd44780 library and the hd44780_I2Cexp i/o class.
It offers a plug an play experience as it locates the i2c address and figures out the pin mapping used on the i2c backpack.
After installing the library, run the included I2CexpDiag sketch to verify that everything is working.
Then you can try the included examples for the hd44780_I2Cexp i/o class and look at them to see which header files to include, how to declare your lcd object and how to use the library.
The library is available in the IDE through the IDE library manager.
You can read more about it on the github repository page and the wiki here:
The library includes lots of documentation / information wich can be found in the Documentation example.
For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.
To install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.