From 47a05f3ac55655d49581007006f8e4ec117f3fc6 Mon Sep 17 00:00:00 2001 From: Dooho Yi Date: Sat, 6 Feb 2021 00:53:14 +0900 Subject: [PATCH] roundly update + fact 1: we cannot use D1-D4 set. (D2 for LED, D4 for TXD1) + fact 2: using D5-D8 set again. (N.B. but to get proper stepping sequence w/ accelstepper lib. u need to CROSS D6 and D7 wiring, otherwise very poor torque & uni-directional not sane movements.) --- roundly/platformio.ini | 40 ++++++++++++++++++++++++++++------------ roundly/src/main.cpp | 12 ++++++++---- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/roundly/platformio.ini b/roundly/platformio.ini index 15c072e..1160c96 100644 --- a/roundly/platformio.ini +++ b/roundly/platformio.ini @@ -1,3 +1,13 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + [platformio] default_envs = d1_mini_pro @@ -5,27 +15,33 @@ default_envs = d1_mini_pro framework = arduino upload_speed = 921600 upload_port = - /dev/ttyUSB0 - /dev/tty.SLAB_USBtoUART + /dev/ttyUSB0 + /dev/tty.SLAB_USBtoUART lib_deps = - SPI - Wire - 64 ; ArduinoJson - 1269 ; Painless Mesh - 265 ; AccelStepper + SPI + Wire + 64 + 1269 + 265 [env:nodemcuv2] platform = espressif8266 board = nodemcuv2 lib_deps = - ${env.lib_deps} - ESP8266WiFi + ${env.lib_deps} + ESP8266WiFi [env:d1_mini_pro] platform = espressif8266 board = d1_mini_pro lib_deps = - ${env.lib_deps} - ESP8266WiFi + ${env.lib_deps} + ESP8266WiFi upload_speed = 460800 -; 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 + +[env:nanoatmega328_TEST] +platform = atmelavr +board = nanoatmega328 +lib_deps = + 265 +upload_speed = 57600 diff --git a/roundly/src/main.cpp b/roundly/src/main.cpp index b65197a..a31b3aa 100644 --- a/roundly/src/main.cpp +++ b/roundly/src/main.cpp @@ -199,6 +199,10 @@ void stepping() { float velocity = steps / dur * 1000; // unit conv.: (steps/msec) --> (steps/sec) float speed = fabs(velocity); // + Serial.print("target_step --> "); Serial.println(target_step); + Serial.print("dur --> "); Serial.println(dur); + Serial.print("cur_step --> "); Serial.println(cur_step); + // if (speed > STEPS_PER_SEC_MAX) { Serial.println("oh.. it might be TOO FAST for me.."); } else { @@ -411,10 +415,10 @@ void setup() { randomSeed(analogRead(0)); //stepper - pinMode(D5, OUTPUT); - pinMode(D6, OUTPUT); - pinMode(D7, OUTPUT); - pinMode(D8, OUTPUT); + // pinMode(D1, OUTPUT); + // pinMode(D2, OUTPUT); + // pinMode(D3, OUTPUT); + // pinMode(D4, OUTPUT); /// " /// The fastest motor speed that can be reliably supported is about 4000 steps per /// second at a clock frequency of 16 MHz on Arduino such as Uno etc.