Documentation: examples/CompPage/CompPage.ino Source File

| Documentation For Arduino users

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

- File List
- File Members

CompPage.ino
1
17 #include "Nextion.h"
18
19 NexPage page0 = NexPage(0, 0, "page0");
20 NexPage page1 = NexPage(1, 0, "page1");
21 NexPage page2 = NexPage(2, 0, "page2");
22 NexPage page3 = NexPage(3, 0, "page3");
23
24 NexTouch *nex_listen_list[] =
25 {
26 &page0,
27 &page1,
28 &page2,
29 &page3,
30 NULL
31 };
32
33 void page0PopCallback(void *ptr)
34 {
35 dbSerialPrintln("page0PopCallback");
36 page1.show();
37 }
38
39 void page1PopCallback(void *ptr)
40 {
41 dbSerialPrintln("page1PopCallback");
42 page2.show();
43 }
44
45 void page2PopCallback(void *ptr)
46 {
47 dbSerialPrintln("page2PopCallback");
48 page3.show();
49 }
50
51 void page3PopCallback(void *ptr)
52 {
53 dbSerialPrintln("page3PopCallback");
54 page0.show();
55 }
56
57 void setup(void)
58 {
59 nexInit();
60 dbSerialPrintln("setup begin");
61
62 page0.attachPop(page0PopCallback);
63 page1.attachPop(page1PopCallback);
64 page2.attachPop(page2PopCallback);
65 page3.attachPop(page3PopCallback);
66
67 dbSerialPrintln("setup end");
68 }
69
70 void loop(void)
71 {
72 nexLoop(nex_listen_list);
73 }
nexLoop
void nexLoop(NexTouch *nex_listen_list[])
Listen touch event and calling callbacks attached before.
Definition: NexHardware.cpp:235
NexPage::show
bool show(void)
Show itself.
Definition: NexPage.cpp:23
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
NexPage
A special component , which can contain other components such as NexButton, NexText and NexWaveform...
Definition: NexPage.h:31
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