CompSlider_v0_32.ino
#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)
{
nexInit();
h0.attachPop(h0PopCallback);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}
nexLoop
void nexLoop(NexTouch *nex_listen_list[])
Listen touch event and calling callbacks attached before.
Definition: NexHardware.cpp:235
NexSlider
NexSlider component.
Definition: NexSlider.h:30
NexText::setText
bool setText(const char *buffer)
Set text attribute of component.
Definition: NexText.cpp:32
NexSlider::getValue
bool getValue(uint32_t *number)
Get the value of slider.
Definition: NexSlider.cpp:22
NexTouch::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Attach an callback function of pop touch event.
Definition: NexTouch.cpp:39
nexInit
bool nexInit(void)
Init Nextion.
Definition: NexHardware.cpp:220
Nextion.h
The header file including all other header files provided by this library.
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53
NexText
NexText component.
Definition: NexText.h:30