print string to display

This commit is contained in:
Anton Jacker
2024-06-13 14:03:18 +02:00
parent 2d01315d45
commit 215155035e
2 changed files with 48 additions and 0 deletions

View File

@ -112,6 +112,31 @@ void Display::print(char *value){
}
};
char Display::stringToCharArray(String value) {
const int len = value.length() + 1; // +1 for the null terminator
char msgBuffer[len]; // Create a buffer of the appropriate length
value.toCharArray(msgBuffer, len); // Copy the string into the buffer, including the null terminator
return *msgBuffer;
}
void Display::print(String value){
const int len = value.length() + 1; // +1 for the null terminator
char msgBuffer[len]; // Create a buffer of the appropriate length
value.toCharArray(msgBuffer, len);
this->print(msgBuffer);
};
void Display::println(String value){
const int len = value.length() + 1; // +1 for the null terminator
char msgBuffer[len]; // Create a buffer of the appropriate length
value.toCharArray(msgBuffer, len);
this->println(msgBuffer);
};
void Display::println(char *value){
this ->print(value);
this->print("\n");