33* Copyright (c) 2023 by M5Stack
44* Equipped with M5Core sample source code
55* 配套 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
88*
99* Describe: Glass.
1010* Date: 2023/2/23
1111*******************************************************************************
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左/右侧的按键来对计数器进行减/加.
1215*/
1316#include < M5Stack.h>
1417#include < UNIT_GLASS.h>
@@ -34,9 +37,10 @@ void setup() {
3437 string_buffer = " M5STACK" ;
3538 Glass.set_string_buffer (string_buffer.c_str ());
3639 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" ;
3842 Glass.set_string_buffer (string_buffer.c_str ());
39- Glass.draw_string (0 , 24 , 16 , 1 );
43+ Glass.draw_string (24 , 24 , 16 , 1 );
4044 Glass.show ();
4145}
4246
@@ -57,10 +61,11 @@ void loop() {
5761 count--;
5862 }
5963
60- string_buffer = " Count: " ;
64+ string_buffer = " Count: " ;
6165 string_buffer += count;
6266 string_buffer += " " ;
6367 Glass.set_string_buffer (string_buffer.c_str ());
64- Glass.draw_string (0 , 48 , 16 , 1 );
68+ Glass.draw_string (36 , 48 , 16 , 1 );
6569 Glass.show ();
70+ delay (20 );
6671}
0 commit comments