Hi,
Checking the different issues already mentioned in the forum, I didn’t find any corresponding to mine so I created this one. It’s long because it’s accurate .
CONTEXT
Using Arduino Uno R3,
Using Grove-LCD RGB Backlight V4.0,
Using Usual Arduino IDE in Windows10
Connecting the lcd using the Arduino Uno (SCL, SDA, 5V, GND) pins via a personal shield. (not involved in the issue, but I precise it nevertheless).
CASE 1:
In usual main object.ino (i.e. containing the usual setUp() and loop() functions), I code the usual lines regarding the lcd :
rgb_lcd lcd; //->in global part
lcd.begin(16, 2); //in setUp() function
etc…
==>There, the LCD is working fine as expected, no issue to be mentioned in that case.
CASE 2:
In that second case, No code regarding the LCD in main object.ino this time.
But the usual code lines are now placed in a Class aside (whose code is in the same directory as the main object).
(An object is instantiated from that class in the main object with new operator. No originality here)
In that Class, I tried different options :
-lcd.begin(16, 2) in the object constructor
-lcd.begin(16, 2) in a dedicated function triggered from the main object,
-lcd->begin(16, 2) (instantiating beforehand the lcd with new operator)
==>The result is always the same: the LCD displays:
-a first line completely dark (but we can barely distinguish nevertheless, the first line which was supposed to be displayed by my code),
-a second line completely empty (whereas a second line is expected).
-(Backlight seems working properly).
CASE 3:
It’s a mix between CASE1 and CASE2:
-The usual code is placed in the main object, up to the “lcd.begin(16, 2);” instruction,
-The remaining part of the lcd code is placed in the Class aside using a second object “lcd2”
(where no lcd2.begin(16,2); is triggered).
==>Here, the LCD is working fine also.
QUESTION:
Is there a way to do the “lcd.begin(16, 2)” in the Class aside (and keep the LCD working of course)?
(because the case3 makes me instantiating 2 LCD objects (lcd and lcd2) which is quit impacting the SRAM occupied).
Thanks for having read that issue description up to its end