display-text

bradzilla84/arduino-tft-lib/display-text

Write text to the screen at the given coordinates.
display-text
@/display-text
Write text to the screen at the given coordinates.
DEV@/tft-device
Colour@/colour
Colour of TXT
Stringstring
The text you want to write on the screen.
Sizenumber
Sets the size of text that follows. The default size is "1". Each change in size increases the text by 10 pixels in height. That is, size 1 = 10 pixels, size 2 =20 pixels, and so on.
XLocnumber
The location on the X-axis you want to start drawing text to the screen.
YLocnumber
The location on the Y-axis you want to start drawing text to the screen.
INITpulse
Display
display-text
DEV
Colour
String
Size
XLoc
YLoc
INIT
OUT
OK
OKpulse
Completed OK
OUT@/tft-device
To use the node in your project you should have the bradzilla84/arduino-tft-lib library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {

};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // The node responds only if there is an input pulse
    if (!isInputDirty<input_INIT>(ctx)){
    emitValue<output_OUT>(ctx, getValue<input_DEV>(ctx));
        return;}


    auto Display = getValue<input_DEV>(ctx);  // Get a pointer to the `TFT` class instance
    auto Colour = getValue<input_Colour>(ctx);
    auto TXTString = getValue<input_String>(ctx);

    String Stringg = "";// I REALY NEED a better way to do this XString to char
    for (auto it = TXTString.iterate(); it; ++it)
        Stringg = Stringg + (*it);

    int str_len = Stringg.length() + 1;
    char TXT[str_len];
    Stringg.toCharArray(TXT, str_len);

    // write the static text to the screen
    // set the font color
    Display->stroke(Colour.Red,Colour.Green,Colour.Blue);
    // set the font size
    Display->setTextSize(getValue<input_Size>(ctx));
    // write the text to the screen
    Display->text((TXT), getValue<input_XLoc>(ctx), getValue<input_YLoc>(ctx));
    // Pulse that module initialized successfully

    emitValue<output_OUT>(ctx, Display);
    emitValue<output_OK>(ctx, 1);
}