I am trying to display my string variable (train_id) on a ST7735 TFT Module. I learnt that I need to convert the string to char array first as string is not supported by the TFT Library. I used the code provided in this forum but how can I then display the result on the TFT display using the printf() Function?
Thank you for your help.
Remo
String str = train_id;
// Length (with one extra character for the null terminator)
int str_len = str.length() + 1;
// Prepare the character array (the buffer)
char char_array[str_len];
// Copy it over
(str.toCharArray(char_array, str_len));
So, yes, Adafruit_ST7735 ultimately inherits from Print. Print knows how to Print an object of the String class. Therefore, I see no basis for OP's original statement:
patschifig123:
I learnt that I need to convert the string to char array first as string is not supported by the TFT Library.