Skip to content

Commit

Permalink
Add copyright dependency information
Browse files Browse the repository at this point in the history
  • Loading branch information
renletao committed Jan 14, 2025
1 parent 04bc51f commit d375924
Show file tree
Hide file tree
Showing 68 changed files with 1,870 additions and 2,165 deletions.
22 changes: 16 additions & 6 deletions examples/Unit/ACCEL_ADXL345/ACCEL_ADXL345.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
/*
Description: Read ACCEL Unit three-axis acceleration
Please install library before compiling:
Arduino-ADXL345: https://github.com/jakalada/Arduino-ADXL345
*/
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
/*
* @Hardwares: M5Core + Unit Accel
* @Platform Version: Arduino M5Stack Board Manager v2.1.3
* @Dependent Library:
* M5Stack@^0.4.6: https://github.com/m5stack/M5Stack
* Arduino-ADXL345: https://github.com/jakalada/Arduino-ADXL345
*/

#include <M5Stack.h>
#include <ADXL345.h>

ADXL345 accel(ADXL345_ALT);

void setup() {
void setup()
{
// put your setup code here, to run once:
M5.begin();
M5.Power.begin();
Expand Down Expand Up @@ -72,7 +81,8 @@ void setup() {
}
}

void loop() {
void loop()
{
// put your main code here, to run repeatedly:
if (accel.update()) {
M5.Lcd.fillRect(0, 130, 360, 30, BLACK);
Expand Down
52 changes: 23 additions & 29 deletions examples/Unit/ANGLE/ANGLE.ino
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
/*
*******************************************************************************
* Copyright (c) 2023 by M5Stack
* Equipped with M5Core sample source code
* 配套 M5Core 示例源代码
* Visit for more information: https://docs.m5stack.com/en/core/gray
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/gray
*
* Describe: Angle. 角度计
* Date: 2021/8/9
*******************************************************************************
Description: Read the Angle of the angometer and convert it to digital display
读取角度计的角度,并转换为数字量显示
*/
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
/*
* @Hardwares: M5Core + Unit Angle
* @Platform Version: Arduino M5Stack Board Manager v2.1.3
* @Dependent Library:
* M5Stack@^0.4.6: https://github.com/m5stack/M5Stack
*/

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

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

void setup() {
M5.begin(); // Init M5Stack. 初始化M5Stack
M5.Power.begin(); // Init power 初始化电源模块
pinMode(
sensorPin,
INPUT); // Sets the specified pin to input mode. 设置指定引脚为输入模式
void setup()
{
M5.begin(); // Init M5Stack. 初始化M5Stack
M5.Power.begin(); // Init power 初始化电源模块
pinMode(sensorPin, INPUT); // Sets the specified pin to input mode. 设置指定引脚为输入模式
dacWrite(25, 0);
M5.Lcd.setTextSize(2); // Set the font size to 2. 设置字体大小为2
M5.Lcd.print("the value of ANGLE: ");
}

void loop() {
cur_sensorValue = analogRead(
sensorPin); // read the value from the sensor. 读取当前传感器的值
M5.Lcd.setCursor(0, 25); // Place the cursor at (0,25). 将光标固定在(0,25)
void loop()
{
cur_sensorValue = analogRead(sensorPin); // read the value from the sensor. 读取当前传感器的值
M5.Lcd.setCursor(0, 25); // Place the cursor at (0,25). 将光标固定在(0,25)
if (abs(cur_sensorValue - last_sensorValue) > 10) { // debaunce
M5.Lcd.fillRect(0, 25, 100, 25, BLACK);
M5.Lcd.print(cur_sensorValue);
Expand Down
35 changes: 28 additions & 7 deletions examples/Unit/Angle8/Angle8.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
/*
* @Hardwares: M5Core + Unit 8Angle
* @Platform Version: Arduino M5Stack Board Manager v2.1.3
* @Dependent Library:
* M5GFX@^0.2.3: https://github.com/m5stack/M5GFX
* M5Unified@^0.2.2: https://github.com/m5stack/M5Unified
* M5Unit-8Angle:https://github.com/m5stack/M5Unit-8Angle
*/

#include <M5Unified.h>
#include <M5GFX.h>
#include "M5_ANGLE8.h"
Expand All @@ -8,7 +22,8 @@ M5_ANGLE8 angle8;

uint32_t rgb_c = 0;

void print_adc_val(uint8_t i, uint16_t adc_v) {
void print_adc_val(uint8_t i, uint16_t adc_v)
{
canvas.drawRect(0, i * 20, 200, 15, 1);
canvas.fillRect(0, i * 20, map(adc_v, 0, 4096, 0, 200), 15, 1);
canvas.setCursor(215, i * 20);
Expand All @@ -17,7 +32,8 @@ void print_adc_val(uint8_t i, uint16_t adc_v) {
}

// ADC 12 Bit
void TaskADC12(uint16_t delay_t) {
void TaskADC12(uint16_t delay_t)
{
canvas.createSprite(display.width(), 160);
canvas.fillSprite(0);
uint16_t adc_v = 0;
Expand All @@ -30,7 +46,8 @@ void TaskADC12(uint16_t delay_t) {
}

// Breathing RGBLED
void TaskRGBLED_1(uint8_t br, uint16_t delay_t) {
void TaskRGBLED_1(uint8_t br, uint16_t delay_t)
{
canvas.createSprite(display.width(), 35);
rgb_c = 0;
canvas.fillSprite(0);
Expand All @@ -47,7 +64,8 @@ void TaskRGBLED_1(uint8_t br, uint16_t delay_t) {
}
}

void TaskRGBLED_2(uint8_t br, uint16_t delay_t) {
void TaskRGBLED_2(uint8_t br, uint16_t delay_t)
{
canvas.createSprite(display.width(), 35);
rgb_c = 0;
canvas.fillSprite(0);
Expand All @@ -64,7 +82,8 @@ void TaskRGBLED_2(uint8_t br, uint16_t delay_t) {
}
}

void TaskRGBLED_3(uint32_t color, uint8_t br, uint16_t delay_t) {
void TaskRGBLED_3(uint32_t color, uint8_t br, uint16_t delay_t)
{
canvas.createSprite(display.width(), 35);
rgb_c = 0;
canvas.fillSprite(0);
Expand All @@ -77,7 +96,8 @@ void TaskRGBLED_3(uint32_t color, uint8_t br, uint16_t delay_t) {
canvas.pushSprite(0, 205);
}

void setup() {
void setup()
{
M5.begin();
display.begin();
canvas.setColorDepth(1); // mono color
Expand All @@ -96,7 +116,8 @@ void setup() {
canvas.pushSprite(0, 0);
}

void loop() {
void loop()
{
M5.update();
if (M5.BtnA.wasReleased()) {
TaskRGBLED_3(0xffffff, 100, 2);
Expand Down
110 changes: 0 additions & 110 deletions examples/Unit/Angle8/M5_ANGLE8.cpp

This file was deleted.

41 changes: 0 additions & 41 deletions examples/Unit/Angle8/M5_ANGLE8.h

This file was deleted.

Loading

0 comments on commit d375924

Please sign in to comment.