
My basic operation system for STM32 MCU
Diff: Nextion/Nextion.cpp
- Revision:
- 0:5f09301c4a9c
- Child:
- 3:5047e6339308
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nextion/Nextion.cpp Sun Feb 24 07:23:24 2019 +0000 @@ -0,0 +1,18 @@ +#include "Nextion.h" +#include "mbed.h" + +Nextion::Nextion(PinName Tx, PinName Rx) : lcd(Tx, Rx) {} + +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); +} + +void Nextion::init() +{ + lcd.baud(9600); + lcd.printf("rest%c%c%c", 0xff, 0xff, 0xff); + wait(0.2); +}