aodreds:
I found the same problem, then I tried I2Cexpdiag the result as attached files,
Not the same problem. I'd recommend starting your own thread.
--- bill
aodreds:
I found the same problem, then I tried I2Cexpdiag the result as attached files,
Not the same problem. I'd recommend starting your own thread.
--- bill
Hi Michiel,
We had the exact same problem as you had. We found a solution following the advice of "ground fungus" file>examples>hd44780>ioclass>hd44780_i2cexp>HelloWorld. If you don't have the hd44780 library yet. Go to Sketch>Include Library>Manage Libraries>type in hd44780 in the filter your search bar>scroll down and select the library written by Bill Perry. Once you have this then follow the first set of instructions.
Hope this works!
PrierX
bperrybap:
Why did you choose to not run the diagnostic sketch, I2CexpDiag as recommended?--- bill
I did and everything works now, thanks for the tips. It took me a while to discover that the trimpot on the back is for the contrast. I first only tried to change the intensity of the backlight with a resistor between the pins at the back. This did not help so I gave up and used 4-digit 7-segment displays. But now it works!
Something completely different: I looked at your hd44780 library and the hd44780_I2Cexp.h file. The .h file contains a lot of implementation code instead of just declarations, violating proper programming practices. Wy did you organise it this way? What are the reasons you could not properly split declaration (interface) and definition (implementation)?
Again thanks for the help!
So my question in #11 was singularly astute then? ![]()
michielper:
I did and everything works now, thanks for the tips. It took me a while to discover that the trimpot on the back is for the contrast.
That was the very first thing that was asked about in reply #1 (and indeed again in #11 and #12)...
michielper:
Something completely different: I looked at your hd44780 library and the hd44780_I2Cexp.h file. The .h file contains a lot of implementation code instead of just declarations, violating proper programming practices. Wy did you organise it this way? What are the reasons you could not properly split declaration (interface) and definition (implementation)?
Yes all the implementation code for the i/o classes is in the .h file.
While "standard" programming practices is to not put code in .h file
C++ is a bit different when it comes to where you may need to place the code.
C++ even requires class code to be in the .h file when certain C++ capabilities are used like certain types of polymorphism.
Having all the i/o class implementation code in the .h files was intentionally chosen.
Most of the reasons are preparing for future capabilities that are not in the code/library yet.
Here are few of the reasons that this was done.
With Arduino sketches, allows the use of defines in the sketch to control features at compile time.
This is not possible if the library code is compiled separately.
Defines could be used to enable/disable certain capabilities that may not be needed to allow the code to be smaller and faster.
This was also driven by the more recent versions of gcc are no longer able to optimize out unused virtual functions the way it can with normal unused functions.
Specifically the hd44780_I2Cexp i/o class has support for two types of backpacks and when only one is being used there is close to 800 bytes to 1k of code that is not used taking up space.
It allows the code to automatically compile time adapt other 3rd party libraries being used by the sketch
This reduces the code footprint as the code is specific code needed can be selected at compile time vs having to do things runtime.
It can make developing other 3rd party libraries want or need to use the lcd functions.
If they also put their class code in the .h file they could do compile time polymorphic class adaption to adapt to a specific LCD library.
In the future, as I start to take advantage of these more advanced C++ features in the code and also want to reduce the code footprint size, the library will undergo a refactoring. At that point the hd44780 base class code will likely also move into a .h file.
--- bill
I had a simular problem, tried everything.
Solution was simple: adjust the resistor on the back and now you will see letters
|hi———————————————————————————————————————————————————————|
// | made by Arduino_uno_guy 11/13/2019 |
// | Arduino Project Hub
// |———————————————————————————————————————————————————————|
#include LiquidCrystal_I2C.h
#include Wire.h
//initialize the liquid crystal library
//the first parameter is the I2C address
//the second parameter is how many rows are on your screen
//the third parameter is how many columns are on your screen
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
//initialize lcd screen
lcd.init();
// turn on the backlight
lcd.backlight();
}
void loop() {
//wait for a second
delay(1000)
// tell the screen to write on the top row
lcd.setCursor(0,0);
// tell the screen to write “hello, from” on the top row
lcd.print(“Hello, From”);
// tell the screen to write on the bottom row
lcd.setCursor(0,1);
// tell the screen to write “Arduino_uno_guy” on the bottom row
// you can change whats in the quotes to be what you want it to be!
lcd.print(“Arduino_uno_guy”);
Make sure you have liquidcrystali2c and wire library's installed worked for me