
My basic operation system for STM32 MCU
Diff: Nextion/Nextion.cpp
- Revision:
- 3:5047e6339308
- Parent:
- 0:5f09301c4a9c
--- a/Nextion/Nextion.cpp Sun Feb 24 07:36:22 2019 +0000 +++ b/Nextion/Nextion.cpp Sun Feb 24 17:41:44 2019 +0000 @@ -5,9 +5,9 @@ void Nextion::setText(char _id[3], char _txt[50]) { - char data[60]; - sprintf(data, "%s.txt=\"%s\"%c%c%c", _id, _txt, 0xff, 0xff, 0xff); - lcd.printf(data); + char _data[60]; + sprintf(_data, "%s.txt=\"%s\"%c%c%c", _id, _txt, 0xff, 0xff, 0xff); + lcd.printf(_data); } void Nextion::init() @@ -16,3 +16,17 @@ lcd.printf("rest%c%c%c", 0xff, 0xff, 0xff); wait(0.2); } + +void Nextion::page(int _page) +{ + char _data[60]; + sprintf(_data, "page %d%c%c%c",_page, 0xff, 0xff, 0xff); + lcd.printf(_data); +} + +void Nextion::setProgress(char _id[3], int _value) +{ + char _data[60]; + sprintf(_data, "%s.val=%d%c%c%c",_id, _value, 0xff, 0xff, 0xff); + lcd.printf(_data); +} \ No newline at end of file