Go Down

Topic: display stored string using 8uglib (Read 1 time) previous topic - next topic


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:
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 !


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.



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


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

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131