| Documentation For Arduino users

- Main Page
- Related Pages
- Modules
- Classes
- Files
- Examples

- File List
- File Members

CompPicture.ino
1
19 #include "Nextion.h"
20
21 /*
22 * Declare a picture object [page id:0,component id:1, component name: "p0"].
23 */
24 NexPicture p0 = NexPicture(0, 1, "p0");
25
26 NexTouch *nex_listen_list[] =
27 {
28 &p0,
29 NULL
30 };
31
32 void p0PopCallback(void *ptr)
33 {
34 uint32_t number = 0;
35 dbSerialPrintln("p0PopCallback");
36
37 p0.getPic(&number);
38
39 if (number == 1)
40 {
41 number = 2;
42 }
43 else
44 {
45 number = 1;
46 }
47
48 p0.setPic(number);
49 }
50
51
52 void setup(void)
53 {
54 nexInit();
55 p0.attachPop(p0PopCallback);
56 dbSerialPrintln("setup done");
57 }
58
59 void loop(void)
60 {
61 nexLoop(nex_listen_list);
62 }
63
nexLoop
void nexLoop(NexTouch *nex_listen_list[])
Listen touch event and calling callbacks attached before.
Definition: NexHardware.cpp:235
NexPicture::setPic
bool setPic(uint32_t number)
Set picture's number.
Definition: NexPicture.cpp:55
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
NexPicture
NexPicture component.
Definition: NexPicture.h:30
Nextion.h
The header file including all other header files provided by this library.
NexPicture::getPic
bool getPic(uint32_t *number)
Get picture's number.
Definition: NexPicture.cpp:46
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53