Go Down

Topic: display stored string using 8uglib (Read 628 times) previous topic - next topic

djosimd

Hi,
im kind of a newbie on arduino and i need help from experts :p

I've been able to display pretty much what i want on my GLCD TF7565 using th u8glib library. I'm able to display a string using this commande
Code: [Select]

u8g.drawStr(0, 0, "hello world");

but i want to display a double that i converted to a string but when i do something like this:
Code: [Select]

String testString;
//code puting a double value in testString
//...
//...
u8g.drawStr(0, 0, testString);


the program is giving  me an error while compiling, it says:
Quote
no matching function for call to 'U8GLIB_LM6059::drawStr(int,int,String&)


im i doing something wrong or its just impossible to display a previously stored String using the u8glib library ?

Thank you !


olikraus

I assume, that you need to convert the String object to a character array before passing it to drawStr.
Use http://arduino.cc/en/Reference/StringToCharArray.

Oliver


djosimd

I just tried it and its working Thank you so much !!!!

bperrybap

#3
Nov 26, 2012, 11:52 pm Last Edit: Nov 26, 2012, 11:56 pm by bperrybap Reason: 1
glcd includes overloaded functions to handle all the string types.
For String it uses an overloaded wrapper function to handle it.
For u8g, It would be something like:

Code: [Select]
u8g_uint_t U8GLIB::drawStr(u8g_uint_t x, u8g_uint_t y, String &str )
{
  return( drawStr(x, y, str));
}


--- bill

Go Up