1.3 inch OLED - How to Display values connected to ESP8266-12E using I2C

I'm wanting to display temperature values on a 1.3 inch OLED display using u8x8 library

Now I can display text at a screen x/y position as follows: u8x8.drawString(3,1,"Hello World!");

But how can I display values loaded into say variable 'temp' ????

u8x8.drawString(3,1,(temp)); or maybe u8x8.drawString(3,1,(temp));

or similarly something like u8x8.drawString(3,1,(millis());

Any help appreciated...

Good morning, rbright,

drawString prints strings to screen, not values. You will need the print function.

two solutions:

  1. convert value into string and then print string to display with drawString
  2. use the u8g.print function: (in this example the readout < h > of a DHT11 relative humidity sensor)

u8g.setPrintPos (44, 50); // set position
u8g.print (h, 0); // display humidity from DHT22 with no decimals

followed by:

u8g.drawStr (65, 50, "%");

got a nice result!

One of the displays used in a project is a 130*130 pixel 1.3 inch TFT ith a SSD1283A controller. I used the <LCDWIKI_GUI.h> and <LCDWIKI_SPI.h> libraries to get that display going. Is that display identical to yours ?
see my projecs on Thesolaruniverse blog at wordpress.com

photoncatcher Thanks for your advice. I've now resolved my issues be changing my development over to using a Nokia display and using the PCD8544 library.

I've had a look at your blog and found it most inspiring.

Regards