Nextion User Manual
For Arduino developers
CompCrop.ino
1 
17 #include "Nextion.h"
18 
19 NexCrop q0 = NexCrop(0, 1, "q0");
20 
21 NexTouch *nex_listen_list[] =
22 {
23  &q0,
24  NULL
25 };
26 
27 void q0PopCallback(void *ptr)
28 {
29  uint32_t number = 0;
30  dbSerialPrintln("q0PopCallback");
31 
32  q0.getPic(&number);
33 
34  number += 1;
35  number %= 2;
36 
37  q0.setPic(number);
38 }
39 
40 
41 void setup(void)
42 {
43  nexInit();
44  q0.attachPop(q0PopCallback);
45  dbSerialPrintln("setup done");
46 }
47 
48 void loop(void)
49 {
50  nexLoop(nex_listen_list);
51 }
52 
void nexLoop(NexTouch *nex_listen_list[])
Listen touch event and calling callbacks attached before.
bool getPic(uint32_t *number)
Get the number of picture.
Definition: NexCrop.cpp:23
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Attach an callback function of pop touch event.
Definition: NexTouch.cpp:39
bool nexInit(void)
Init Nextion.
The header file including all other header files provided by this library.
bool setPic(uint32_t number)
Set the number of picture.
Definition: NexCrop.cpp:32
NexCrop component.
Definition: NexCrop.h:30
Father class of the components with touch events.
Definition: NexTouch.h:53