Skip to content

Commit d375924

Browse files
author
renletao
committed
Add copyright dependency information
1 parent 04bc51f commit d375924

File tree

68 files changed

+1870
-2165
lines changed

Some content is hidden

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

68 files changed

+1870
-2165
lines changed

examples/Unit/ACCEL_ADXL345/ACCEL_ADXL345.ino

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
/*
2-
Description: Read ACCEL Unit three-axis acceleration
3-
Please install library before compiling:
4-
Arduino-ADXL345: https://github.com/jakalada/Arduino-ADXL345
5-
*/
2+
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
/*
7+
* @Hardwares: M5Core + Unit Accel
8+
* @Platform Version: Arduino M5Stack Board Manager v2.1.3
9+
* @Dependent Library:
10+
* M5Stack@^0.4.6: https://github.com/m5stack/M5Stack
11+
* Arduino-ADXL345: https://github.com/jakalada/Arduino-ADXL345
12+
*/
13+
614
#include <M5Stack.h>
715
#include <ADXL345.h>
816

917
ADXL345 accel(ADXL345_ALT);
1018

11-
void setup() {
19+
void setup()
20+
{
1221
// put your setup code here, to run once:
1322
M5.begin();
1423
M5.Power.begin();
@@ -72,7 +81,8 @@ void setup() {
7281
}
7382
}
7483

75-
void loop() {
84+
void loop()
85+
{
7686
// put your main code here, to run repeatedly:
7787
if (accel.update()) {
7888
M5.Lcd.fillRect(0, 130, 360, 30, BLACK);

examples/Unit/ANGLE/ANGLE.ino

+23-29
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,36 @@
11
/*
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/core/gray
7-
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/gray
8-
*
9-
* Describe: Angle. 角度计
10-
* Date: 2021/8/9
11-
*******************************************************************************
12-
Description: Read the Angle of the angometer and convert it to digital display
13-
读取角度计的角度,并转换为数字量显示
14-
*/
2+
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
/*
7+
* @Hardwares: M5Core + Unit Angle
8+
* @Platform Version: Arduino M5Stack Board Manager v2.1.3
9+
* @Dependent Library:
10+
* M5Stack@^0.4.6: https://github.com/m5stack/M5Stack
11+
*/
1512

1613
#include <M5Stack.h>
17-
int sensorPin =
18-
36; // set the input pin for the potentiometer. 设置角度计的输入引脚
1914

20-
int last_sensorValue =
21-
100; // Stores the value last read by the sensor. 存储传感器上次读取到的值
22-
int cur_sensorValue = 0; // Stores the value currently read by the sensor.
23-
// 存储传感器当前读取到的值
15+
int sensorPin = 36; // set the input pin for the potentiometer. 设置角度计的输入引脚
16+
int last_sensorValue = 100; // Stores the value last read by the sensor. 存储传感器上次读取到的值
17+
int cur_sensorValue = 0; // Stores the value currently read by the sensor.
18+
// 存储传感器当前读取到的值
2419

25-
void setup() {
26-
M5.begin(); // Init M5Stack. 初始化M5Stack
27-
M5.Power.begin(); // Init power 初始化电源模块
28-
pinMode(
29-
sensorPin,
30-
INPUT); // Sets the specified pin to input mode. 设置指定引脚为输入模式
20+
void setup()
21+
{
22+
M5.begin(); // Init M5Stack. 初始化M5Stack
23+
M5.Power.begin(); // Init power 初始化电源模块
24+
pinMode(sensorPin, INPUT); // Sets the specified pin to input mode. 设置指定引脚为输入模式
3125
dacWrite(25, 0);
3226
M5.Lcd.setTextSize(2); // Set the font size to 2. 设置字体大小为2
3327
M5.Lcd.print("the value of ANGLE: ");
3428
}
3529

36-
void loop() {
37-
cur_sensorValue = analogRead(
38-
sensorPin); // read the value from the sensor. 读取当前传感器的值
39-
M5.Lcd.setCursor(0, 25); // Place the cursor at (0,25). 将光标固定在(0,25)
30+
void loop()
31+
{
32+
cur_sensorValue = analogRead(sensorPin); // read the value from the sensor. 读取当前传感器的值
33+
M5.Lcd.setCursor(0, 25); // Place the cursor at (0,25). 将光标固定在(0,25)
4034
if (abs(cur_sensorValue - last_sensorValue) > 10) { // debaunce
4135
M5.Lcd.fillRect(0, 25, 100, 25, BLACK);
4236
M5.Lcd.print(cur_sensorValue);

examples/Unit/Angle8/Angle8.ino

+28-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
/*
7+
* @Hardwares: M5Core + Unit 8Angle
8+
* @Platform Version: Arduino M5Stack Board Manager v2.1.3
9+
* @Dependent Library:
10+
* M5GFX@^0.2.3: https://github.com/m5stack/M5GFX
11+
* M5Unified@^0.2.2: https://github.com/m5stack/M5Unified
12+
* M5Unit-8Angle:https://github.com/m5stack/M5Unit-8Angle
13+
*/
14+
115
#include <M5Unified.h>
216
#include <M5GFX.h>
317
#include "M5_ANGLE8.h"
@@ -8,7 +22,8 @@ M5_ANGLE8 angle8;
822

923
uint32_t rgb_c = 0;
1024

11-
void print_adc_val(uint8_t i, uint16_t adc_v) {
25+
void print_adc_val(uint8_t i, uint16_t adc_v)
26+
{
1227
canvas.drawRect(0, i * 20, 200, 15, 1);
1328
canvas.fillRect(0, i * 20, map(adc_v, 0, 4096, 0, 200), 15, 1);
1429
canvas.setCursor(215, i * 20);
@@ -17,7 +32,8 @@ void print_adc_val(uint8_t i, uint16_t adc_v) {
1732
}
1833

1934
// ADC 12 Bit
20-
void TaskADC12(uint16_t delay_t) {
35+
void TaskADC12(uint16_t delay_t)
36+
{
2137
canvas.createSprite(display.width(), 160);
2238
canvas.fillSprite(0);
2339
uint16_t adc_v = 0;
@@ -30,7 +46,8 @@ void TaskADC12(uint16_t delay_t) {
3046
}
3147

3248
// Breathing RGBLED
33-
void TaskRGBLED_1(uint8_t br, uint16_t delay_t) {
49+
void TaskRGBLED_1(uint8_t br, uint16_t delay_t)
50+
{
3451
canvas.createSprite(display.width(), 35);
3552
rgb_c = 0;
3653
canvas.fillSprite(0);
@@ -47,7 +64,8 @@ void TaskRGBLED_1(uint8_t br, uint16_t delay_t) {
4764
}
4865
}
4966

50-
void TaskRGBLED_2(uint8_t br, uint16_t delay_t) {
67+
void TaskRGBLED_2(uint8_t br, uint16_t delay_t)
68+
{
5169
canvas.createSprite(display.width(), 35);
5270
rgb_c = 0;
5371
canvas.fillSprite(0);
@@ -64,7 +82,8 @@ void TaskRGBLED_2(uint8_t br, uint16_t delay_t) {
6482
}
6583
}
6684

67-
void TaskRGBLED_3(uint32_t color, uint8_t br, uint16_t delay_t) {
85+
void TaskRGBLED_3(uint32_t color, uint8_t br, uint16_t delay_t)
86+
{
6887
canvas.createSprite(display.width(), 35);
6988
rgb_c = 0;
7089
canvas.fillSprite(0);
@@ -77,7 +96,8 @@ void TaskRGBLED_3(uint32_t color, uint8_t br, uint16_t delay_t) {
7796
canvas.pushSprite(0, 205);
7897
}
7998

80-
void setup() {
99+
void setup()
100+
{
81101
M5.begin();
82102
display.begin();
83103
canvas.setColorDepth(1); // mono color
@@ -96,7 +116,8 @@ void setup() {
96116
canvas.pushSprite(0, 0);
97117
}
98118

99-
void loop() {
119+
void loop()
120+
{
100121
M5.update();
101122
if (M5.BtnA.wasReleased()) {
102123
TaskRGBLED_3(0xffffff, 100, 2);

examples/Unit/Angle8/M5_ANGLE8.cpp

-110
This file was deleted.

examples/Unit/Angle8/M5_ANGLE8.h

-41
This file was deleted.

0 commit comments

Comments
 (0)