Adafruit RGB LCD Shield print problem

Hi,

I've written some code where I print lots of strings. To remove the cluster of

lcd.clear();
lcd.setCursor(x,y);
lcd.print("hey");

i've written a simple routine:

void printString(String s, int row, int column, bool wipe){
  
  if(wipe)
    lcd.clear();
  lcd.setCursor(row,column);
  lcd.print(s);
}

But this doesn't work ! Everytime I call it, nothing is printed on the LCD. There's no errors or warnings during the compiling process, but it just doesn't work. In the setup part of the code I've added this:

...
lcd.begin(16, 2);
  lcd.setBacklight(WHITE);
  delay(300);
  lcd.clear();
  progStage = MENU;
  first = true;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Starting");
  delay(2500);
  
  printString(menuOpts[4], 0, 0, true);
  //printVolt(0.41,0,0,true);
  while(1);
...

with menuOpts being

String menuOpts[7] = {"Single Output", "Square Wave","Triangular Wave", "Trapezoidal Wave", "Save Program", "Load Program", "Arbitrary Wave"};

What happens is that the Starting string gets shown, then the lcd goes blank and nothing else happens. I can't see the Save Program string. What's wrong with this code?

Thanks for the help.

I don't know if this is the source of your problem, but most LCD libraries have the arguments:

LCD.setCursor(column, row);

which is opposite of your code. If you ever try to print using a column of 2 or more, there may be a problem.

Still, when both values are 0 it should work since the Starting string works as well. Any other ideas?

What happens if you send

printString("Textstring", 0, 0, true);

instead of a String variable?

Nothing gets printed either… Even if I change the printString routine to:

void printString(String s, int row, int column, bool wipe){
 
  String aux = "hey";
  if(wipe)
    lcd.clear();
  lcd.setCursor(row,column);
  lcd.print(aux);
}

nothing gets printed… on the other hand, if I place that bit of code on the setup routine, the aux string gets printed…

So, some code that you posted a snippet of, wastes a bunch of memory uselessly using the String class and does not work. Some other code that you posted NONE of, does work, even though it uselessly wastes memory, too.

And you want us to explain why? Not a chance.

Post ALL of your code, after getting rid of the String class.