Documentation: examples/CompHotspot/CompHotspot_v0_32.ino Source File

| Documentation For Arduino users

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

- File List
- File Members

CompHotspot_v0_32.ino
1
20 #include "Nextion.h"
21
22 NexHotspot hot0 = NexHotspot(0, 1, "hot0");
23 NexHotspot hot1 = NexHotspot(0, 2, "hot1");
24
25 NexTouch *nex_listen_list[] =
26 {
27 &hot0,
28 &hot1,
29 NULL
30 };
31
32 void hot0PushCallback(void *ptr)
33 {
34 dbSerialPrintln("hot0PushCallback");
35 dbSerialPrint("ptr=");
36 dbSerialPrintln((uint32_t)ptr);
37 }
38
39 void hot1PushCallback(void *ptr)
40 {
41 dbSerialPrintln("hot1PushCallback");
42 dbSerialPrint("ptr=");
43 dbSerialPrintln((uint32_t)ptr);
44 }
45
46 void hot0PopCallback(void *ptr)
47 {
48 dbSerialPrintln("hot0PopCallback");
49 dbSerialPrint("ptr=");
50 dbSerialPrintln((uint32_t)ptr);
51 }
52
53 void hot1PopCallback(void *ptr)
54 {
55 dbSerialPrintln("hot1PopCallback");
56 dbSerialPrint("ptr=");
57 dbSerialPrintln((uint32_t)ptr);
58 }
59
60 void setup(void)
61 {
62 nexInit();
63 hot0.attachPush(hot0PushCallback, &hot0);
64 hot0.attachPop(hot0PopCallback, &hot0);
65 hot1.attachPush(hot1PushCallback, &hot1);
66 hot1.attachPop(hot1PopCallback, &hot1);
67 dbSerialPrintln("setup done");
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
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
Nextion.h
The header file including all other header files provided by this library.
NexHotspot
NexHotspot component.
Definition: NexHotspot.h:30
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53
NexTouch::attachPush
void attachPush(NexTouchEventCb push, void *ptr=NULL)
Attach an callback function of push touch event.
Definition: NexTouch.cpp:27