mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-21 20:11:46 +02:00
print string to display
This commit is contained in:
parent
2d01315d45
commit
215155035e
@ -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){
|
void Display::println(char *value){
|
||||||
this ->print(value);
|
this ->print(value);
|
||||||
this->print("\n");
|
this->print("\n");
|
||||||
|
@ -71,6 +71,29 @@ class Display{
|
|||||||
* @param value the string that should be printed
|
* @param value the string that should be printed
|
||||||
*/
|
*/
|
||||||
void println(char *value);
|
void println(char *value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief prints the passed string right behind the current displaycontent
|
||||||
|
* the sequence "\n" can be used to make a linebreak on the display
|
||||||
|
*
|
||||||
|
* @param value the string "xyz" that should be printed to the display
|
||||||
|
*/
|
||||||
|
void print(String value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief same as the print method, but after the string a line break is inserted
|
||||||
|
*
|
||||||
|
* @param value the string that should be printed
|
||||||
|
*/
|
||||||
|
void println(String value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief string to char
|
||||||
|
*
|
||||||
|
* @param value the string that should be converted to char
|
||||||
|
*/
|
||||||
|
char stringToCharArray(String value);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief flips the horizontal orientation of all content on the display
|
* @brief flips the horizontal orientation of all content on the display
|
||||||
|
Loading…
x
Reference in New Issue
Block a user