Pages: [1]   Go Down
Author Topic: display stored string using 8uglib  (Read 465 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Germany
Offline Offline
Edison Member
*
Karma: 100
Posts: 1235
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dallas, TX USA
Offline Offline
Edison Member
*
Karma: 47
Posts: 2341
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
u8g_uint_t U8GLIB::drawStr(u8g_uint_t x, u8g_uint_t y, String &str )
{
   return( drawStr(x, y, str));
}

--- bill
« Last Edit: November 26, 2012, 05:56:02 pm by bperrybap » Logged

Pages: [1]   Go Up
Jump to: