Is it possible to use a string variable with drawString()? #2105
-
Hi there! From what I can tell from the error, Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This tutorial should help, it uses the String class which makes building strings out of characters and numbers easy. Based on that tutorial example sketch you could replace the Serial.println(stringOne); for example with: tft.drawString(stringOne, x, y); // x, y is position on TFT screen Don't worry about the const qualifier, this simply means the function being called in the library is not allowed to try change the variable. |
Beta Was this translation helpful? Give feedback.
This tutorial should help, it uses the String class which makes building strings out of characters and numbers easy.
https://docs.arduino.cc/built-in-examples/strings/StringConstructors
Based on that tutorial example sketch you could replace the Serial.println(stringOne); for example with:
tft.drawString(stringOne, x, y); // x, y is position on TFT screen
Don't worry about the const qualifier, this simply means the function being called in the library is not allowed to try change the variable.