The reason I'm asking this is that sometimes I need to recycle power on just the LCD module because it gets a glitch and garbles. I've tried adding robustness to its power source, cutting down on noise issues, etc .. (and will continue on that front) but in the meantime I need to hard boot the LCD without resetting the Arduino.
The way the LCD library works is that initialization of the module happens before setup(); I need to re-initialize the LCD module, by cycling its power (using a digital pin), from inside setup() or perhaps even loop();
So, instead of this:
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
// RS, E, D4, D5, D6, D7
LiquidCrystal lcd(53, 51, 41, 37, 39, 35);
setup() {
// stuff...
lcd.begin(24, 2);
lcd.print(" Hello ");
}
loop() {
// stuff..
lcd.print (" Looping ");
}
I need to "prolong" initializing of LCD hardware, and re-use it. I'd like to do something like this:
// include the library code:
#include <LiquidCrystal.h>
setup() {
// stuff...
digitalWrite (LCDpower, HIGH);
delay(2000);
LiquidCrystal lcd(53, 51, 41, 37, 39, 35);
lcd.begin(24, 2);
lcd.print(" Hello ");
}
loop() {
// stuff..
lcd.print (millis());
}
But when I try this, I get compiler scope issues with lcd.print in the loop().
Is there a way to declare the lcd commands in loop() as "extern" or something?
Thanks!