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 ");
}
How can I "prolong" and re-use the initializing of LCD hardware. 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());
}
When I try, I get scope issues with lcd.print in the loop().
Is there a way to declare the lcd commands in loop() as "extern" or something?
The reason I'm doing this is sometimes I need to recycle power on the LCD because it gets garbled. I've tried adding robustness to its power, cutting down noise, etc and will continue on that front but in the meantime I need to hard boot the LCD without resetting the Arduino.
Thanks!