Documentation
For Arduino users
CompSlider.ino
How to Use
This example shows that ,when the slider component on the Nextion screen is released, the text value of text component will be changed every time.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/8/11
#include "Nextion.h"
NexText t0 = NexText(0, 2, "t0");
NexSlider h0 = NexSlider(0, 1, "h0");
NexTouch *nex_listen_list[] =
{
&h0,
NULL
};
void h0PopCallback(void *ptr)
{
uint32_t number = 0;
char temp[10] = {0};
dbSerialPrintln("h0PopCallback");
h0.getValue(&number);
utoa(number, temp, 10);
t0.setText(temp);
}
void setup(void)
{
h0.attachPop(h0PopCallback);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}