Hi friends, I want to show the Serial Monitor in a LCD Display with I2C, but I don't know how. I am a beginner and need it quickly, if some of you have a useful code I would be so happy.
(deleted)
I can't do it. I have been trying for an hour, and it doesn't print in the screen.
This is the code I am using:
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// initialize the serial communications:
Serial.begin(9600);
}
void loop() {
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}
You are trying to diagnose and debug multiple things at once.
Do something simpler first like print "hello world" on the LCD to make sure the Arduino is able to control the LCD.
-- bill
(deleted)
spycatcher2k:
LiquidCrystal_I2C lcd(0x27,16,2);
This does not look correct.
Open one of the examples supplied with the library and look at it (Post it here if you want).
You have made a mistake I made when using this type of display for the first time.
It looks fine to me. But it depends on which library is being used since there are many different libraries that include a LiquidCrystal_I2C class.
That constructor is for the "LiquidCrystal_I2C" library that is available in the IDE library manager.
While that library "normally" uses init() for initialization, oddly enough that library has added a begin() method to be more compatible with the LiquidCrystal API.
When they added the begin() method they should have added a constructor that only requires the i2c address.
Otherwise it is confusing to see the cols,rows being specified in two places.
(in the constructor and in begin())
Another issue can be the i2c address since that library requires entering the i2c address in the constructor.
And even if the i2c address is correct there is no guarantee that the library will work the lcd backpack, since there are several different pin mappings and that library has the pin mappings hard coded.
These reasons/issues is why I recommend using my hd44780 library instead as it easier to use since it will auto self configure the i2c address and the pin mappings.
But again, the first thing should be get a very simple "hello world" sketch running on the LCD.
--- bill