Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

changeLabelText()

Mammad900 edited this page Aug 30, 2020 · 2 revisions

changeLabelText(page, index, value)

Summary

Changes the content of a label

Parameters

  1. Page (int) : The number of the page which contains the label
  2. Index (int) : Index of the label relative to it's container page.
  3. Value (int) : The new content for the label

Returns

Nothing

Example

void loop(){
    changeLabelText(0,PIN_STATUS,(digitalRead(12)==HIGH)?"HIGH":"LOW");
}

Output

The program will repeatedly update the label to show pin status.

Source

void changeLabelText(int page, int i, String val) {
    if (label_text[page][i] != val) {
        HCT
        if (CurrentPage == page) {
            undrawlabel(page, i);
            label_text[page][i] = val;
            drawlabel(page, i);
        }
        else
            label_text[page][i] = val;
    }
}

Note: HCT is a macro for making the rest of the library aware that something has changed.

Clone this wiki locally