forked from vusivus/Nextion-C-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample.c
47 lines (36 loc) · 829 Bytes
/
Example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "nextion/Nextion.h"
#include "util/Utilities.h"
#include <string.h>
#include <stdlib.h>
struct NexObject button, slider;
struct NexObject *nex_listen_list[] = {
&button,
&slider};
long value;
#define buttonPageID 0
#define sliderPageID 0
#define buttonID 1
#define sliderID 2
void main()
{
CreateNexObject(button, buttonPageID, buttonID, "MyButton");
CreateNexObject(slider, sliderPageID, sliderID, "MySlider");
nexInit();
NexSlider_getValue(&slider, &value);
NexSlider_setValue(&slider, value + 20);
NexTouch_attachPop(&button, buttonCallback, 0);
NexTouch_attachPop(&slider, sliderCallback, 0);
while (1)
{
nexLoop(nex_listen_list);
delay_ms(50);
}
}
void buttonCallback(void *ptr)
{
//TODO
}
void sliderCallback(void *ptr)
{
//TODO
}