Waveshare - OLED display from int, uint etc

Hello, this is my first post - question.

Could you please tell me how to properly display data from some int variable (uint16_t is enough) in waveshare OLED 1.5 RGB display? The manufacturer gave a library in which it is possible to display the number, but everywhere it is enclosed in quotation marks ("012") - and the problem is that I have, for example, a measurement result and I would like to immediately display this result on the display. An attempt to give it to the command, unfortunately, gives the bushes :frowning: I don't know what I'm doing wrong :frowning:

Here is an example from this library:
Paint_DrawNum(3, 110, "00:00:00:00", &Font16, 2, GREEN, BLACK);

And I try to display uint with this function , as below :
uint8_t data =012; // for example only
Paint_DrawNum(3, 110, data, &Font16, 2, GREEN, BLACK);

Unfortunately it does not work - I have nonsense on the display. Can someone indicate how to use it correctly? Thank you very much and regards

Does the library really not have a way of displaying simple integers? :open_mouth:

You could investigate snprintf or atoi

Maybe the data type is causing some ambiguity and not understood properly. uint8_t could also be a single character. For example uint8_t with 48 and char with 0 is pretty well the same thing. Change the type of the data variable to simply int and see if that makes any difference.

Fixed

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.