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