Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: ILI9341_t3n is there a simple way to print an integer?

  1. #1

    ILI9341_t3n is there a simple way to print an integer?

    I found the drawFloat function which is handy. However, I'd like to pass an integer to a similar function to get text in the center of the box. drawString means I need to convert the int to string. Haven't found an easy way to do that. Sorry it is such a simple question, but my C skills are weak.

    drawFloat with dp=0 adds a 0 after the decimal point. I don't have room on the display for that. I wasn't expecting that dp=0 and dp=1 give the same result.

    tft.drawFloat((float) newustep, 0, x+w/2, y+h/2); outputs 8.0, thought I would get 8. Really would like to get just 8, as newustep is just an integer. Actually, ustep, N and D are integers. Can someone kindly point me in the right direction? A minimal example would be helpful. Thanks.
    Click image for larger version. 

Name:	PXL_20220530_175915228a.jpg 
Views:	4 
Size:	173.0 KB 
ID:	28528

  2. #2
    Well color me embarrassed. drawNumber works just grand. Can't believe I didn't see that before. Sorry for the noise. Slowly this interface ekes along...
    Click image for larger version. 

Name:	PXL_20220530_182859290a.jpg 
Views:	4 
Size:	174.9 KB 
ID:	28532

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •