Skip to content

Commit 8646529

Browse files
committed
Merge branch 'main' of https://github.com/m5stack/M5AtomS3
2 parents 6e8df5e + b6b80d6 commit 8646529

File tree

4 files changed

+77
-4
lines changed

4 files changed

+77
-4
lines changed

.github/workflows/arduino-action-atoms3-compile.yml renamed to .github/workflows/arduino-action-compile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ jobs:
4040
# You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace
4141
#############################################################################################################
4242
arduino-boards-fqbn:
43-
- m5stack:esp32:atoms3
43+
- m5stack:esp32:m5stack_atoms3
4444

4545
# Specify parameters for each board.
4646
#############################################################################################################
4747
include:
48-
- arduino-boards-fqbn: m5stack:esp32:atoms3
48+
- arduino-boards-fqbn: m5stack:esp32:m5stack_atoms3
4949
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
5050
sketches-exclude: WhistleSwitch,50Hz,SimpleFrequencyDetector
5151

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AtomS3 Library
22

3-
[![Arduino Compile](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-atoms3-compile.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-stickc-plus-compile.yml)
3+
[![Arduino Compile](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-compile.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-compile.yml)
44
[![Arduino Lint](https://github.com/m5stack/M5AtomS3/actions/workflows/Arduino-Lint-Check.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/Arduino-Lint-Check.yml)
55
[![Clang Format](https://github.com/m5stack/M5AtomS3/actions/workflows/clang-format-check.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/clang-format-check.yml)
66

README_cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AtomS3 Library
22

3-
[![Arduino Compile](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-atoms3-compile.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-stickc-plus-compile.yml)
3+
[![Arduino Compile](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-compile.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/arduino-action-compile.yml)
44
[![Arduino Lint](https://github.com/m5stack/M5AtomS3/actions/workflows/Arduino-Lint-Check.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/Arduino-Lint-Check.yml)
55
[![Clang Format](https://github.com/m5stack/M5AtomS3/actions/workflows/clang-format-check.yml/badge.svg)](https://github.com/m5stack/M5AtomS3/actions/workflows/clang-format-check.yml)
66

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* @file AtomicHDriver.ino
3+
* @author SeanKwok ([email protected])
4+
* @brief M5AtomS3 Atomic H-Driver Base Test
5+
* @version 0.1
6+
* @date 2024-01-19
7+
*
8+
*
9+
* @Hardwares: M5AtomS3 + Atomic H-Driver Base
10+
* @Platform Version: Arduino M5Stack Board Manager v2.1.0
11+
* @Dependent Library:
12+
* M5GFX: https://github.com/m5stack/M5GFX
13+
* M5Unified: https://github.com/m5stack/M5Unified
14+
* M5AtomS3: https://github.com/m5stack/M5AtomS3
15+
*/
16+
17+
#include "M5AtomS3.h"
18+
19+
const int IN1_PIN = 6;
20+
const int IN2_PIN = 7;
21+
int freq = 10000;
22+
int ledChannel1 = 0;
23+
int ledChannel2 = 1;
24+
int resolution = 10;
25+
bool direction = true;
26+
int VIN_PIN = 8;
27+
int FAULT_PIN = 5;
28+
29+
void setup() {
30+
auto cfg = M5.config();
31+
AtomS3.begin(cfg);
32+
33+
AtomS3.Display.setTextColor(GREEN);
34+
AtomS3.Display.setTextDatum(middle_center);
35+
AtomS3.Display.setTextFont(&fonts::Orbitron_Light_24);
36+
AtomS3.Display.setTextSize(1);
37+
AtomS3.Display.drawString("H-Driver", AtomS3.Display.width() / 2,
38+
AtomS3.Display.height() / 2);
39+
40+
ledcSetup(ledChannel1, freq, resolution);
41+
ledcSetup(ledChannel2, freq, resolution);
42+
ledcAttachPin(IN1_PIN, ledChannel1);
43+
ledcAttachPin(IN2_PIN, ledChannel2);
44+
pinMode(VIN_PIN, INPUT);
45+
pinMode(FAULT_PIN, INPUT);
46+
ledcWrite(ledChannel1, 0);
47+
ledcWrite(ledChannel2, 0);
48+
}
49+
50+
void loop() {
51+
if (M5.BtnA.pressedFor(2000)) {
52+
ledcWrite(ledChannel1, 0);
53+
ledcWrite(ledChannel2, 0);
54+
}
55+
56+
if (M5.BtnA.wasPressed()) {
57+
if (direction) {
58+
ledcWrite(ledChannel1, 1000);
59+
ledcWrite(ledChannel2, 0);
60+
} else {
61+
ledcWrite(ledChannel1, 0);
62+
ledcWrite(ledChannel2, 1000);
63+
}
64+
direction = !direction;
65+
}
66+
67+
M5.update();
68+
Serial.println("VIN IN: " +
69+
String((analogRead(VIN_PIN) * 10.0 / 4095.0) * 3.6));
70+
if (digitalRead(FAULT_PIN) == 0) {
71+
Serial.println("FAULT!");
72+
}
73+
}

0 commit comments

Comments
 (0)