| Documentation For Arduino users

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

- File List
- File Members

CompCrop_v0_32.ino
1
20 #include "Nextion.h"
21
22 /*
23 * Declare a crop object [page id:0,component id:1, component name: "q0"].
24 */
25 NexCrop q0 = NexCrop(0, 1, "q0");
26
27 NexTouch *nex_listen_list[] =
28 {
29 &q0,
30 NULL
31 };
32
33 /*
34 * Crop component pop callback function.
35 * In this example,the image of current crop component will be changed every time when it is released.
36 */
37 void q0PopCallback(void *ptr)
38 {
39 uint32_t number = 0;
40 dbSerialPrintln("q0PopCallback");
41
42 q0.getPic(&number);
43
44 number += 1;
45 number %= 2;
46
47 q0.setPic(number);
48 }
49
50 void setup(void)
51 {
52 nexInit();
53 q0.attachPop(q0PopCallback);
54 dbSerialPrintln("setup done");
55 }
56
57 void loop(void)
58 {
59 nexLoop(nex_listen_list);
60 }
61
nexLoop
void nexLoop(NexTouch *nex_listen_list[])
Listen touch event and calling callbacks attached before.
Definition: NexHardware.cpp:235
NexCrop::getPic
bool getPic(uint32_t *number)
Get the number of picture.
Definition: NexCrop.cpp:46
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.
NexCrop::setPic
bool setPic(uint32_t number)
Set the number of picture.
Definition: NexCrop.cpp:55
NexCrop
NexCrop component.
Definition: NexCrop.h:30
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53