goodmanrs / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

Unable to print integers/floats/numeric values. #117

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Arduino Enviroment.
ST9720 but i think this is a library issue?

{
 int i=10;

  u8g.setFont(u8g_font_fixed_v0);
  u8g.setFontRefHeightExtendedText();
  u8g.setDefaultForegroundColor();
  u8g.setFontPosTop();

  u8g.drawStr(0,0,i);

}

Fails compile with:
encoderGLCD.ino: In function 'void draw()':
encoderGLCD:110: error: call of overloaded 'drawStr(u8g_uint_t, int, int&)' is 
ambiguous
C:\ether10\arduino-1.0.2\libraries\U8glib/U8glib.h:142: note: candidates are: 
u8g_uint_t U8GLIB::drawStr(u8g_uint_t, u8g_uint_t, const char*) <near match>
C:\ether10\arduino-1.0.2\libraries\U8glib/U8glib.h:172: note:                 
u8g_uint_t U8GLIB::drawStr(u8g_uint_t, u8g_uint_t, const __FlashStringHelper*) 
<near match>

I could also be missing something extremely obvious.
Colin

Original issue reported on code.google.com by colin.ga...@gmail.com on 27 Nov 2012 at 7:17

GoogleCodeExporter commented 8 years ago
You need to use the "print" member function. drawStr is more a low level 
procedure. "print" has been derived from the Arduino "print" class, so it 
supports all the feature of the usual print features in the Arduino 
Environment, including print of numerical values. Also the documentation is 
part of the Arduino Project.

Original comment by olikr...@gmail.com on 27 Nov 2012 at 8:12

GoogleCodeExporter commented 8 years ago
How to print something at (x,y)?

Original comment by adi.srin...@gmail.com on 2 Oct 2014 at 8:47

GoogleCodeExporter commented 8 years ago
u8g.drawStr(x,y,someting);

With the print() command, you need to use 
void U8GLIB::setPrintPos(u8g_uint_t x, u8g_uint_t y) 
before print()

Original comment by olikr...@gmail.com on 3 Oct 2014 at 5:16