Documentation
For Arduino users
CompPicture_v0_32.ino
1 
21 #include "Nextion.h"
22 
23 /*
24  * Declare a picture object [page id:0,component id:1, component name: "p0"].
25  */
26 NexPicture p0 = NexPicture(0, 1, "p0");
27 
28 NexTouch *nex_listen_list[] =
29 {
30  &p0,
31  NULL
32 };
33 
34 void p0PopCallback(void *ptr)
35 {
36  uint32_t number = 0;
37  dbSerialPrintln("p0PopCallback");
38 
39  p0.getPic(&number);
40 
41  if (number == 1)
42  {
43  number = 2;
44  }
45  else
46  {
47  number = 1;
48  }
49 
50  p0.setPic(number);
51 }
52 
53 
54 void setup(void)
55 {
56  nexInit();
57  p0.attachPop(p0PopCallback);
58  dbSerialPrintln("setup done");
59 }
60 
61 void loop(void)
62 {
63  nexLoop(nex_listen_list);
64 }
65 
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:55
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:46
Father class of the components with touch events.
Definition: NexTouch.h:53