Skip to content
Discussion options

You must be logged in to vote

Good question!

The library supports implementation of this in the sketch. The functions drawString, drawNumber and drawFloat return the pixel width of the string/number rendered so this can be used to position a squence of text and numeric values. For example:

  int16_t x = 10;
  int16_t y = 10;
  int16_t val = 123;

  x+= tft.drawNumber(val, x, y);
  tft.drawString(" F", x, y);

If x and y are constants ( 10 and 20 in this case) then a single line of code would work:

tft.drawString(" F", tft.drawNumber(val, 10, 20) + 10, 20);

Since this is quite simple (once you know how!) I am not convinced adding a new function is required and would be less flexible. For example non-numeric characters…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Bodmer
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment