File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ M5Canvas canvas(&display);
34
34
HX711 scale;
35
35
36
36
void setup () {
37
- M5.begin (); // Init M5Stack. 初始化M5Stack
38
- M5.Power .begin (); // Init power 初始化电源模块
37
+ M5.begin (); // Init M5Stack. 初始化M5Stack
38
+ M5.Power .begin (); // Init power 初始化电源模块
39
39
display.begin ();
40
40
canvas.setColorDepth (1 ); // mono color
41
41
canvas.createSprite (display.width (), display.height ());
Original file line number Diff line number Diff line change
1
+ /*
2
+ *******************************************************************************
3
+ * Copyright (c) 2023 by M5Stack
4
+ * Equipped with M5Core sample source code
5
+ * 配套 M5Core 示例源代码
6
+ * Visit for more information: https://docs.m5stack.com/en/unit/MiniOLED%20Unit
7
+ * 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/MiniOLED%20Unit
8
+ *
9
+ * Describe: Unit MiniOLED
10
+ * Date: 2023/07/28
11
+ *******************************************************************************
12
+ Depend Libraries:
13
+ -[U8g2](https://github.com/olikraus/U8g2_Arduino)
14
+ Please install the required libraries and connect the Unit MiniOLED to the
15
+ PORT-A port (G21/22)
16
+ 请安装依赖库并将Unit MiniOLED 连接到PORT-A端口(G21/22)
17
+ */
18
+ #include < Arduino.h>
19
+ #include < U8g2lib.h>
20
+ #include < Wire.h>
21
+
22
+ #define SDA_PIN 21
23
+ #define SCL_PIN 22
24
+
25
+ U8G2_SSD1306_72X40_ER_F_HW_I2C u8g2 (
26
+ U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // EastRising 0.42" OLED
27
+
28
+ void setup (void ) {
29
+ Wire.begin (SDA_PIN, SCL_PIN);
30
+ u8g2.begin ();
31
+ }
32
+
33
+ void loop (void ) {
34
+ u8g2.clearBuffer (); // clear the internal memory
35
+ u8g2.setFont (u8g2_font_ncenB08_tr); // choose a suitable font
36
+ u8g2.drawStr (10 , 20 , " Hello" ); // write something to the internal memory
37
+ u8g2.drawStr (10 , 30 , " M5Stack!" );
38
+ u8g2.sendBuffer (); // transfer internal memory to the display
39
+ delay (1000 );
40
+ }
You can’t perform that action at this time.
0 commit comments