![](/media/cache/profiles/15ae3b9d6286f1b2a489ea4f3f4abaed.50x50_q85.jpg)
Testprogram for TMC2209-Library. Uses Speed-Control via VACTUAL instead of Step/Dir
Dependencies: TMCStepper mRotaryEncoder-os
Diff: main.cpp
- Revision:
- 3:209a9c414f54
- Parent:
- 2:94c5b3f09463
- Child:
- 4:12bfa2c1729f
diff -r 94c5b3f09463 -r 209a9c414f54 main.cpp --- a/main.cpp Sat Feb 06 20:00:31 2021 +0000 +++ b/main.cpp Tue Mar 16 21:13:37 2021 +0000 @@ -22,7 +22,7 @@ #define GR 288 #define DRIVER_ADDRESS 0b00 // TMC2209 Driver address according to MS1 and MS2 -#define R_SENSE 0.11f // R-Sense in OHM .Match to your driver +#define R_SENSE 0.11f // R-Sense in OHM.Match to your driver #define MICROSTEPS 128 // # of microsteps #define RMSCURRENT 500 // RMS current of Stepper Coil in mA @@ -78,12 +78,12 @@ if (actspeed > maxspeed) { actspeed = maxspeed; } - //printf("actspeed: %i",actspeed); + printf("actspeed: %i",actspeed); stepper.VACTUAL(actspeed*MICROSTEPS);// Set Speed to value ThisThread::sleep_for(25ms); //wait } printf("VACTUAL(): %zu \r\n", stepper.VACTUAL()); - ThisThread::sleep_for(60s); + ThisThread::sleep_for(5s); // decrease maxspeed = 0; while (actspeed > maxspeed) { @@ -91,7 +91,7 @@ if (actspeed < 0) { actspeed = 0; } - //printf("actspeed: %i",actspeed); + printf("actspeed: %i",actspeed); stepper.VACTUAL(actspeed*MICROSTEPS);// Set Speed to value ThisThread::sleep_for(25ms); //wait }