| Documentation For Arduino users

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

- File List
- File Members

CompWaveform_v0_32.ino
1
18 #include "Nextion.h"
19
20 #define LEVEL_HIGH (30)
21 #define LEVEL_LOW (0)
22
23 #define CH0_OFFSET (40 - LEVEL_HIGH/2)
24 #define CH1_OFFSET (CH0_OFFSET + 40 * 1)
25 #define CH2_OFFSET (CH0_OFFSET + 40 * 2)
26 #define CH3_OFFSET (CH0_OFFSET + 40 * 3)
27
28
29 NexWaveform s0 = NexWaveform(0, 1, "s0");
30
31 static uint8_t ch0_data = LEVEL_LOW;
32 static uint8_t ch1_data = LEVEL_LOW;
33 static uint8_t ch2_data = LEVEL_LOW;
34 static uint8_t ch3_data = LEVEL_LOW;
35
36 void setup(void)
37 {
38 nexInit();
39 dbSerialPrintln("setup done");
40 }
41
42 void loop(void)
43 {
44 static uint32_t started = 0;
45 if (millis() - started >= 2000)
46 {
47 started = millis();
48 if (LEVEL_HIGH == ch0_data)
49 {
50 ch0_data = LEVEL_LOW;
51 }
52 else
53 {
54 ch0_data = LEVEL_HIGH;
55 }
56 }
57
58 ch1_data = ch0_data + random(0, 2);
59 ch2_data = ch0_data + random(0, 5);
60 ch3_data = ch0_data + random(0, 8);
61
62 s0.addValue(0, CH0_OFFSET + ch0_data);
63 s0.addValue(1, CH1_OFFSET + ch1_data);
64 s0.addValue(2, CH2_OFFSET + ch2_data);
65 s0.addValue(3, CH3_OFFSET + ch3_data);
66
67 }
68
nexInit
bool nexInit(void)
Init Nextion.
Definition: NexHardware.cpp:220
NexWaveform::addValue
bool addValue(uint8_t ch, uint8_t number)
Add value to show.
Definition: NexWaveform.cpp:22
Nextion.h
The header file including all other header files provided by this library.
NexWaveform
NexWaveform component.
Definition: NexWaveform.h:29