This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
changeLabelText()
Mammad900 edited this page Aug 30, 2020
·
2 revisions
Changes the content of a label
- Page (
int
) : The number of the page which contains the label - Index (
int
) : Index of the label relative to it's container page. - Value (
int
) : The new content for the label
Nothing
void loop(){
changeLabelText(0,PIN_STATUS,(digitalRead(12)==HIGH)?"HIGH":"LOW");
}
The program will repeatedly update the label to show pin status.
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.