-
Hello everyone, Below my test code. Can anyone tell/help me how to use the non-blocking function of the lib to poll the serial port while the motor is moving and change the motor speed? Thanks a lot ` #define dirPinStepper 4 FastAccelStepperEngine engine = FastAccelStepperEngine(); // --------- Eigene Definitionen ---------- String buttons_read = ""; // Zwischenspreeicher Auslesen Button void setup() {
} void serialRunWatch() {
} void loop() {
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Apparently the bullet list in the readme is not complete. In the API explanation is written for acceleration: „ New value will be used after call to move/moveTo/runForward/runBackward/applySpeedAcceleration/moveByAcceleration“. Especially applySpeedAcceleration() is most straightforward. If using non-blocking, then two functions come into play to get the status of the motor: isRunning() and getCurrentPosition(). If you move the motor without ˋtrueˋ as second parameter, then the program will just continue to run. If you like to queue commands from the serial, then you would need to wait using isRunning() before calling the next move(). If you like the motor execute immediately commands from serial, then just call move() disregarding the current running status of the motor. FastAccelStepper will perform the needed acceleration/deceleration magic/math for you. |
Beta Was this translation helpful? Give feedback.
-
Hello gin, Over night (a lot of coffee - little sleep) I found out a lot more. Also the variable true/false within moveTo() to turn blocking on or off. In the meantime I've written some code around it and have the motor control (quite well) under control. Now I'm going to develop everything further so that I have a solid basis for controlling the stepper with dynamic changes (via serial control by the nextion display) of speed/target points while running. After that it would be great if I could post the relevant parts of the code here again, so that you or everyone else can take a look and give me tips on where/how I can optimize something. |
Beta Was this translation helpful? Give feedback.
Hello gin,
and first of all: Thank you for the library itself and the support 👍
Over night (a lot of coffee - little sleep) I found out a lot more. Also the variable true/false within moveTo() to turn blocking on or off.
In the meantime I've written some code around it and have the motor control (quite well) under control.
I'm not fundamentally & totally new to programming. BUT - it's just been 30 years since my last times.
Now I'm going to develop everything further so that I have a solid basis for controlling the stepper with dynamic changes (via serial control by the nextion display) of speed/target points while running.
Hopefully I can do that, because I don't want to bore you with st…