3
3
* Copyright (c) 2023 by M5Stack
4
4
* Equipped with M5Core sample source code
5
5
* 配套 M5Core 示例源代码
6
- * Visit for more information: https://docs.m5stack.com/en/core/gray
7
- * 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/gray
6
+ * Visit for more information: https://docs.m5stack.com/en/unit/Glass%20Unit
7
+ * 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/Glass%20Unit
8
8
*
9
9
* Describe: Glass.
10
10
* Date: 2023/2/23
11
11
*******************************************************************************
12
+ Connect the Unit_Glass to Port A and press the buttons on the left/right side of
13
+ the Unit Glass to subtract/add to the counter.
14
+ 将Unit_Glass连接到Port A,按Unit Glass左/右侧的按键来对计数器进行减/加.
12
15
*/
13
16
#include < M5Stack.h>
14
17
#include < UNIT_GLASS.h>
@@ -34,9 +37,10 @@ void setup() {
34
37
string_buffer = " M5STACK" ;
35
38
Glass.set_string_buffer (string_buffer.c_str ());
36
39
Glass.draw_string (36 , 0 , 16 , 1 );
37
- string_buffer = " 2023-02-24" ;
40
+ delay (20 ); // Ensure complete character display. 保证字符显示完全
41
+ string_buffer = " 2023-02-24" ;
38
42
Glass.set_string_buffer (string_buffer.c_str ());
39
- Glass.draw_string (0 , 24 , 16 , 1 );
43
+ Glass.draw_string (24 , 24 , 16 , 1 );
40
44
Glass.show ();
41
45
}
42
46
@@ -57,10 +61,11 @@ void loop() {
57
61
count--;
58
62
}
59
63
60
- string_buffer = " Count: " ;
64
+ string_buffer = " Count: " ;
61
65
string_buffer += count;
62
66
string_buffer += " " ;
63
67
Glass.set_string_buffer (string_buffer.c_str ());
64
- Glass.draw_string (0 , 48 , 16 , 1 );
68
+ Glass.draw_string (36 , 48 , 16 , 1 );
65
69
Glass.show ();
70
+ delay (20 );
66
71
}
0 commit comments