Jump to content
  • 0

How to write variable to OLED display?


Roberto!

Question

Hello,

I'm having trouble writing a variable to the OLED display. There seems to be a lot of documentation on writing strings and graphics, but very little documentation on how to write a float or a double to the OLED display. Can someone point me in the right direction? Does it use the "putChar" command?

I'm using the Chipkit uC32 and Arduino interface. 

Thanks,

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

@Roberto!

I believe you will need to set up a string to be put on the display using the Oled.putString() function. Unfortunately sprintf may or may not be fully implemented in Arduino with regards to floats and doubles, meaning you may have to insert your float into a string manually.

I'd recommend trying the following code snippet, where var is your float, and str is an appropriately sized empty character array:

sprintf(str, "%f", var);
OLED.putString(str);

If that doesn't work, review this thread, as it looks like there may be a few useful work arounds.

Hope this helps,

Arthur

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...