Skip to content

Commit

Permalink
add m5stack-core
Browse files Browse the repository at this point in the history
  • Loading branch information
botamochi6277 committed Dec 2, 2023
1 parent 6f8f09d commit 30d9a1a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 20 deletions.
35 changes: 34 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,37 @@ src/SCSCL.cpp
src/SCSerial.cpp
src/SMS_STS.cpp

.env
.env

### Generated by gibo (https://github.com/simonwhitaker/gibo)
### https://raw.github.com/github/gitignore/72190ee30bd1e2ccc233222341435adacb7a6500/Global/macOS.gitignore

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


18 changes: 11 additions & 7 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:m5stick-c]
[platformio]
default_envs = m5stack-atom
monitor_speed = 115200

[env:m5stack-atom]
platform = espressif32
board = m5stack-atom
framework = arduino
monitor_speed = 115200
build_flags =
-D M5ATOM

[env:seeed_xiao]
platform = atmelsam
board = seeed_xiao
framework = arduino
monitor_speed = 115200
build_flags =
-D XIAO

[env:m5stack-core1]
platform = espressif32
board = m5stack-core-esp32
framework = arduino
32 changes: 20 additions & 12 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
#include <Arduino.h>

#include "SCServo.h"

#ifdef M5ATOM
#ifdef SEEED_XIAO_M0
#define RX1 7
#define TX1 6
#endif

#ifdef ARDUINO_M5Stack_ATOM
#define RX1 21
#define TX1 25
#endif

#ifdef ARDUINO_M5Stack_Core_ESP32
// CORE2??
#define RX1 19
#define TX1 27
#endif

SMS_STS st;

short max_sweep = 4095;
short min_sweep = 0;
unsigned short speed = 3400;
unsigned char acc = 50;

void setup()
{
void setup() {
// LED_BUILTIN;
Serial.begin(115200); // serial for debugging
#ifdef M5ATOM
Serial.begin(115200); // serial for debugging
Serial1.begin(1000000, SERIAL_8N1, RX1, TX1);
#endif
#ifdef XIAO
Serial1.begin(1000000); // serial for servos
#endif

st.pSerial = &Serial1;
delay(1000);
if (!Serial1.available()) {
Serial.println("Serial1 is unavailable");
}
}

void loop()
{
void loop() {
Serial.println("start sweeping");
st.RegWritePosEx(0, max_sweep, speed, acc);
st.RegWritePosEx(1, max_sweep, speed, acc);
st.RegWriteAction();
delay(1884); //[(P1-P0)/Speed]*1000+[Speed/(Acc*100)]*1000
delay(1884); //[(P1-P0)/Speed]*1000+[Speed/(Acc*100)]*1000

st.RegWritePosEx(0, min_sweep, speed, acc);
st.RegWritePosEx(1, min_sweep, speed, acc);
Expand Down

0 comments on commit 30d9a1a

Please sign in to comment.