shanren
October 11, 2023, 12:05am
1
Hi all.
The TFT_eSPI.h
has: drawString(const char *string, int32_t x, int32_t y, uint8_t font), // Draw string using specified font number
and I have int count = 0;
how to drawString my count instead of string?
count is any natural number.
like: drawString(count, int32_t x, int32_t y, uint8_t font),
?
Thanks
Adam
Great!
It works!
Thank you Delta_G .
J-M-L
October 11, 2023, 2:15pm
4
Delta_G:
EDIT: sprintf is better.
did you mean snprintf() ?
I find strtol() (and its siblings) to be more adequate (and uses up less flash) when you have only one number to read.
J-M-L
October 11, 2023, 2:17pm
6
oops sorry - coffee time ! indeed you want to go from int to ascii.
that being said, itoa() is part of the standard lib but not ANSI-C and is not part of C++. the arduino environment and our compiler supports it.
J-M-L
October 11, 2023, 5:55pm
8
yes as they say in the doc
This function is not defined in ANSI-C and is not part of C++, but is supported by some compilers.
and so they recommend sprintf() as the portable option (but this comes with consequences I think on the code size on our small MCUs)
system
Closed
April 8, 2024, 5:56pm
9
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.