Skip to content

Commit d8f9962

Browse files
committed
Update Product Url
1 parent 7de06f4 commit d8f9962

File tree

154 files changed

+17681
-16712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+17681
-16712
lines changed

examples/Advanced/Display/Display_Unicode/Display_Unicode.ino

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Copyright (c) 2021 by M5Stack
44
* Equipped with M5Core2 sample source code
55
* 配套 M5Core2 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/en/core/core2
6+
* Visit for more information: https://docs.m5stack.com/en/core/core2
77
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/core2
88
*
9-
* describe: Display_Unicode. Unicode显示
10-
* date: 2021/7/23
9+
* Describe: Display_Unicode. Unicode显示
10+
* Date: 2021/7/23
1111
*******************************************************************************
1212
*/
1313

@@ -16,29 +16,43 @@
1616
#include <M5Core2.h>
1717
#include "CUF_24px.h"
1818

19-
void setup()
20-
{
21-
M5.begin(); //Init M5Stack. 初始化M5Core2
22-
M5.Lcd.setFreeFont(&unicode_24px); //Set the GFX font to use. 设置要使用的GFX字体
23-
M5.Lcd.setTextDatum(TC_DATUM); //Set text alignment to center-up alignment. 设置文本对齐方式为居中向上对齐
19+
void setup() {
20+
M5.begin(); //Init M5Stack. 初始化M5Core2
21+
M5.Lcd.setFreeFont(
22+
&unicode_24px); //Set the GFX font to use. 设置要使用的GFX字体
23+
M5.Lcd.setTextDatum(
24+
TC_DATUM); //Set text alignment to center-up alignment. 设置文本对齐方式为居中向上对齐
2425
}
2526

26-
void loop()
27-
{
27+
void loop() {
2828
M5.Lcd.fillScreen(0);
29-
M5.Lcd.drawString("Hello world", 160, 60, 1); //Hello world is displayed in font 1 on (1600.60).
30-
M5.Lcd.drawString("你好 世界", 160, 90, 1); //在(160,60)处以字体1显示hello world
29+
M5.Lcd.drawString("Hello world", 160, 60,
30+
1); //Hello world is displayed in font 1 on (1600.60).
31+
M5.Lcd.drawString("你好 世界", 160, 90,
32+
1); //在(160,60)处以字体1显示hello world
3133
M5.Lcd.drawString("Здравствуй мир", 160, 120, 1);
3234
M5.Lcd.drawString("こんにちは せかい", 160, 150, 1);
3335
delay(3000);
3436

35-
M5.Lcd.fillScreen(0); //Fill the screen with black (used to clear the screen) is equivalent to clear (). 使屏幕充满黑色(用来清屏)等同于clear()
36-
M5.Lcd.setCursor(0, 30); // Set the text cursor 0,30 position. 设置文本光标在(0,30)处
37-
M5.Lcd.printf("☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚇⚈⚉⚊⚋⚌⚍⚎⚏⚐⚑⚒⚓⚔⚕⚖⚗⚘⚙⚚⚛⚜⚝⚞⚟A⚠⚡⚢⚣⚤⚥⚦⚧⚨⚩⚪⚫⚬⚭⚮⚯B⚰⚱⚲⚳⚴⚵⚶⚷⚸⚹⚺⚻⚼⚽⚾⚿C⛀⛁⛂⛃⛄⛅⛆⛇⛈⛉⛊⛋⛌⛍⛎⛏D⛐⛑⛒⛓⛔⛕⛖⛗⛘⛙⛚⛛⛜⛝⛞⛟E⛠⛡⛢");
37+
M5.Lcd.fillScreen(
38+
0); //Fill the screen with black (used to clear the screen) is equivalent to clear (). 使屏幕充满黑色(用来清屏)等同于clear()
39+
M5.Lcd.setCursor(
40+
0, 30); // Set the text cursor 0,30 position. 设置文本光标在(0,30)处
41+
M5.Lcd.printf(
42+
"☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏"
43+
"♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚇⚈⚉⚊⚋⚌⚍⚎⚏⚐⚑⚒⚓⚔⚕⚖⚗"
44+
"⚘⚙⚚⚛⚜⚝⚞⚟A⚠⚡⚢⚣⚤⚥⚦⚧⚨⚩⚪⚫⚬⚭⚮⚯B⚰⚱⚲⚳⚴⚵⚶⚷⚸⚹⚺⚻⚼⚽⚾⚿C⛀⛁⛂⛃⛄⛅⛆⛇⛈⛉⛊⛋⛌⛍⛎⛏D⛐⛑⛒⛓⛔⛕⛖⛗⛘⛙⛚⛛"
45+
"⛜⛝⛞⛟E⛠⛡⛢");
3846
delay(3000);
3947

4048
M5.Lcd.fillScreen(0);
4149
M5.Lcd.setCursor(0, 30);
42-
M5.Lcd.printf("⛣⛤⛥⛦⛧⛨⛩⛪⛫⛬⛭⛮⛯F⛰⛱⛲⛳⛴⛵⛶⛷⛸⛹⛺⛻⛼⛽⛾⛿✀✁✂✃✄✅✆✇✈✉✊✋✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❌❍❎❏❐❑❒❓❔❕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧❨❩❪❫❬❭❮❯❰❱❲❳❴❵❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔➕➖➗➘➙➚➛➜➝➞➟A➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯B➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾➿");
50+
M5.Lcd.printf(
51+
"⛣⛤⛥⛦⛧⛨⛩⛪⛫⛬⛭⛮⛯F⛰⛱⛲⛳⛴⛵⛶⛷⛸⛹⛺⛻⛼⛽⛾⛿✀✁✂✃✄✅✆✇✈✉✊✋✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥"
52+
""
53+
""
54+
"✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❌❍❎❏❐❑❒❓❔❕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧❨❩❪❫❬❭❮❯"
55+
"❰❱❲❳❴❵❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔➕➖➗➘➙➚➛➜➝➞➟A➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯B➰➱➲➳➴➵"
56+
"➶➷➸➹➺➻➼➽➾➿");
4357
delay(3000);
4458
}

examples/Advanced/Display/HZK16/HZK16.ino

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Copyright (c) 2021 by M5Stack
44
* Equipped with M5Core2 sample source code
55
* 配套 M5Core2 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/en/core/core2
6+
* Visit for more information: https://docs.m5stack.com/en/core/core2
77
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/core2
88
*
9-
* describe: Character library. 字库
10-
* date: 2021/7/28
9+
* Describe: Character library. 字库
10+
* Date: 2021/7/28
1111
*******************************************************************************
1212
1313
-----PLEASE SEE THE README----
@@ -19,27 +19,37 @@
1919

2020
DisplayCh displaych;
2121
void setup() {
22-
M5.begin(); // Init M5Stack. 初始化M5Stack
23-
displaych.loadHzk16(); //Load the Chinese character library (be sure to load before using the Chinese character library). 加载汉字库(务必在使用汉字库前加载)
24-
displaych.setTextColor(WHITE, BLACK); //Set the text color to white and the text background color to black (mandatory). 设置文字颜色为白色,文字背景颜色为黑色(必加)
22+
M5.begin(); // Init M5Stack. 初始化M5Stack
23+
displaych
24+
.loadHzk16(); //Load the Chinese character library (be sure to load before using the Chinese character library). 加载汉字库(务必在使用汉字库前加载)
25+
displaych.setTextColor(
26+
WHITE,
27+
BLACK); //Set the text color to white and the text background color to black (mandatory). 设置文字颜色为白色,文字背景颜色为黑色(必加)
2528
// Set text with red highlight color
26-
displaych.setHighlightColor(RED); //Set the text highlight color to red. 设置文字高亮颜色为红色
27-
displaych.setTextSize(1); //Set text size to 1. 设置字号大小为1 Set text size to 1(必加)
29+
displaych.setHighlightColor(
30+
RED); //Set the text highlight color to red. 设置文字高亮颜色为红色
31+
displaych.setTextSize(
32+
1); //Set text size to 1. 设置字号大小为1 Set text size to 1(必加)
2833
}
2934

3035
void loop() {
31-
displaych.setCursor(0,0,1); //Set the cursor at (0,0) and the size to 1(mandatory). 将光标设置在(0,0)处,并设置字号为1(必加)
32-
displaych.writeHzk(AscStr); //Display the contents of AscStr here (which can be changed in str.h). 在此处显示AscStr中的内容(可在str.h中更改)
36+
displaych.setCursor(
37+
0, 0,
38+
1); //Set the cursor at (0,0) and the size to 1(mandatory). 将光标设置在(0,0)处,并设置字号为1(必加)
39+
displaych.writeHzk(
40+
AscStr); //Display the contents of AscStr here (which can be changed in str.h). 在此处显示AscStr中的内容(可在str.h中更改)
3341
delay(1000); //delay 1000ms. 延迟1000ms
34-
displaych.setCursor(0,45);
35-
displaych.writeHzk(GbkStr); //Display the contents of GbkStr here (which can be changed in str.h). 在此处显示GbkStr中的内容(可在str.h中更改)
42+
displaych.setCursor(0, 45);
43+
displaych.writeHzk(
44+
GbkStr); //Display the contents of GbkStr here (which can be changed in str.h). 在此处显示GbkStr中的内容(可在str.h中更改)
3645
delay(1000);
3746
//Highlight the text. 高亮显示文本
3847
displaych.highlight(true); //Turn on highlight. 开启高亮显示
39-
displaych.setCursor(0,65);
48+
displaych.setCursor(0, 65);
4049
displaych.writeHzk(GbkStr);
4150
delay(1000);
42-
displaych.fillScreen(BLACK); //Fill the screen with black color, equivalent to empty the screen. 填充屏幕颜色为黑色,等效于清空屏幕
43-
displaych.highlight(false); //Turn off highlight. 关闭高亮显示
51+
displaych.fillScreen(
52+
BLACK); //Fill the screen with black color, equivalent to empty the screen. 填充屏幕颜色为黑色,等效于清空屏幕
53+
displaych.highlight(false); //Turn off highlight. 关闭高亮显示
4454
delay(500);
4555
}

examples/Advanced/Display/TFT_Ellipse/TFT_Ellipse.ino

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,45 @@
33
* Copyright (c) 2021 by M5Stack
44
* Equipped with M5Core2 sample source code
55
* 配套 M5Core2 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/en/core/core2
6+
* Visit for more information: https://docs.m5stack.com/en/core/core2
77
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/core2
88
*
9-
* describe: Ellipse drawing. 椭圆绘制
10-
* date: 2021/7/26
9+
* Describe: Ellipse drawing. 椭圆绘制
10+
* Date: 2021/7/26
1111
*******************************************************************************/
1212

1313
#include <M5Core2.h>
1414

1515
void setup(void) {
16-
M5.begin(); //Init M5Core2. 初始化M5Core2
16+
M5.begin(); //Init M5Core2. 初始化M5Core2
1717
}
1818

1919
void loop() {
2020
// Draw some random ellipses. 绘制一些随机形状的椭圆
21-
for (int i = 0; i < 40; i++)
22-
{
21+
for (int i = 0; i < 40; i++) {
2322
int rx = random(60);
2423
int ry = random(60);
2524
int x = rx + random(320 - rx - rx);
2625
int y = ry + random(240 - ry - ry);
27-
M5.Lcd.fillEllipse(x, y, rx, ry, random(0xFFFF)); //At (x, y), draw a filled ellipse with random width and height of rx, ry with random color random (0xFFFF). 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的填充椭圆
26+
M5.Lcd.fillEllipse(
27+
x, y, rx, ry,
28+
random(
29+
0xFFFF)); //At (x, y), draw a filled ellipse with random width and height of rx, ry with random color random (0xFFFF). 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的填充椭圆
2830
}
2931

3032
delay(2000);
31-
M5.Lcd.clear(); //清空屏幕
33+
M5.Lcd.clear(); //清空屏幕
3234

33-
for (int i = 0; i < 40; i++)
34-
{
35+
for (int i = 0; i < 40; i++) {
3536
int rx = random(60);
3637
int ry = random(60);
3738
int x = rx + random(320 - rx - rx);
3839
int y = ry + random(240 - ry - ry);
39-
M5.Lcd.drawEllipse(x, y, rx, ry, random(0xFFFF));//At (x, y), draw an elliptical wire frame with a random width and height of rx, ry in a random color (0xFFFF). 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的椭圆线框
40+
M5.Lcd.drawEllipse(
41+
x, y, rx, ry,
42+
random(
43+
0xFFFF)); //At (x, y), draw an elliptical wire frame with a random width and height of rx, ry in a random color (0xFFFF). 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的椭圆线框
4044
}
4145

4246
delay(2000);
4347
}
44-
45-
46-

examples/Advanced/EzData/EzData.ino

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Copyright (c) 2021 by M5Stack
44
* Equipped with M5Core2 sample source code
55
* 配套 M5Core2 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/en/core/core2
6+
* Visit for more information: https://docs.m5stack.com/en/core/core2
77
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/core2
88
*
9-
* describe: EzData.
10-
* date: 2021/10/23
9+
* Describe: EzData.
10+
* Date: 2021/10/23
1111
*******************************************************************************
1212
*/
1313
#include "M5Core2.h"
@@ -19,67 +19,67 @@ const char* password = "xingchentansuo123";
1919
const char* token = "";
2020

2121
void setup() {
22-
M5.begin(); //Initialize M5Stack
23-
if(setupWifi(ssid,password)){ //Connect to wifi. 连接到wifi
24-
M5.Lcd.printf("Success connecting to %s\n",ssid);
25-
}else{
26-
M5.Lcd.printf("Connecting to %s failed\n",ssid);
22+
M5.begin(); //Initialize M5Stack
23+
if (setupWifi(ssid, password)) { //Connect to wifi. 连接到wifi
24+
M5.Lcd.printf("Success connecting to %s\n", ssid);
25+
} else {
26+
M5.Lcd.printf("Connecting to %s failed\n", ssid);
2727
}
2828
}
2929

3030
void loop() {
31-
//Save the data 20 to the top of the testData topic queue. 保存数据20至 testData 队列首位
32-
if(setData(token,"testData",20)){
31+
//Save the data 20 to the top of the testData topic queue. 保存数据20至 testData 队列首位
32+
if (setData(token, "testData", 20)) {
3333
M5.Lcd.printf("Success sending data to the topic\n");
34-
}else{
34+
} else {
3535
M5.Lcd.print("Fail to save data\n");
3636
}
3737
delay(5000);
3838

3939
//Save 3 data in sequence to the first place of testList. 依次保存3个数据至 testList首位
40-
for(int i=0;i<3;i++){
41-
if(addToList(token,"testList",i)){
42-
M5.Lcd.printf("Success sending %d to the list\n",i);
43-
}else{
40+
for (int i = 0; i < 3; i++) {
41+
if (addToList(token, "testList", i)) {
42+
M5.Lcd.printf("Success sending %d to the list\n", i);
43+
} else {
4444
M5.Lcd.print("Fail to save data\n");
4545
}
4646
delay(100);
4747
}
4848
delay(5000);
4949

5050
//Get a piece of data from a topic and store the value in result. 从一个 topic中获取一个数据,并将值存储在 result
51-
int result=0;
52-
if(getData(token,"testData",result)){
53-
M5.Lcd.printf("Success get data %d\n",result);
54-
}else{
51+
int result = 0;
52+
if (getData(token, "testData", result)) {
53+
M5.Lcd.printf("Success get data %d\n", result);
54+
} else {
5555
M5.Lcd.print("Fail to get data\n");
5656
}
5757
delay(5000);
5858

59-
//Get a set of data from a list and store the values in the Array array. 从一个 list中获取一组数据,并将值存储在 Array数组中
60-
int Array[3]={};
61-
if(getData(token,"testList",Array,0,3)){
59+
//Get a set of data from a list and store the values in the Array array. 从一个 list中获取一组数据,并将值存储在 Array数组中
60+
int Array[3] = {};
61+
if (getData(token, "testList", Array, 0, 3)) {
6262
M5.Lcd.print("Success get list\n");
63-
for(int i=0;i<3;i++){
64-
M5.Lcd.printf("Array[%d]=%d,",i,Array[i]);
63+
for (int i = 0; i < 3; i++) {
64+
M5.Lcd.printf("Array[%d]=%d,", i, Array[i]);
6565
}
6666
M5.Lcd.println("");
67-
}else{
67+
} else {
6868
M5.Lcd.println("Fail to get data");
6969
}
7070
delay(5000);
7171

7272
//Remove data
73-
if(removeData(token,"testData"))
73+
if (removeData(token, "testData"))
7474
M5.Lcd.printf("Success remove data\n");
7575
else
7676
M5.Lcd.println("Fail to remove data");
7777

78-
if(removeData(token,"testList"))
78+
if (removeData(token, "testList"))
7979
M5.Lcd.printf("Success remove data from the list\n");
8080
else
8181
M5.Lcd.println("Fail to remove data");
8282
delay(5000);
8383
M5.Lcd.fillScreen(BLACK);
84-
M5.Lcd.setCursor(0,0);
84+
M5.Lcd.setCursor(0, 0);
8585
}

0 commit comments

Comments
 (0)