About SSD1306 (U8GLIB 64x128 OLED display)

Hi, this code works well and displays hello world

u8g.drawStr(0,50,“Hello world”);

but this only displays “ack” (sometimes “LF” or other things.)

u8g.setPrintPos(0,40);
u8g.print(distance,0); //distance is unsigned long value

What should be the problem?

Hi kralece,

I ran your instructions on my favorite Arduino Nano connected with a i2c SSD1306 128*64 OLED.

I got a nice display of the value of distance only if distance is declared as a float variable rather than a unsigned long.

You can also use

double distance;

success, photoncatcher

Thank you very much, that helped a lot.