a version to test
Dependencies: X-NUCLEO-IHM05A1
Revision 15:c781dda7e44c, committed 2018-12-07
- Comitter:
- gidiana
- Date:
- Fri Dec 07 11:21:04 2018 +0000
- Parent:
- 14:1b70207bf922
- Child:
- 16:1dc772fba09f
- Commit message:
- tweakings;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Dec 06 21:01:23 2018 +0000
+++ b/main.cpp Fri Dec 07 11:21:04 2018 +0000
@@ -11,13 +11,13 @@
/* Initialization parameters of the motor connected to the expansion board. */
l6208_init_t init =
{
- 150, //Acceleration rate in step/s^2 or (1/16)th step/s^2 for microstep modes
+ 1500, //Acceleration rate in step/s^2 or (1/16)th step/s^2 for microstep modes
80, //Acceleration current torque in % (from 0 to 100)
- 150, //Deceleration rate in step/s^2 or (1/16)th step/s^2 for microstep modes
+ 1500, //Deceleration rate in step/s^2 or (1/16)th step/s^2 for microstep modes
80, //Deceleration current torque in % (from 0 to 100)
1000, //Running speed in step/s or (1/16)th step/s for microstep modes
- 50, //Running current torque in % (from 0 to 100)
- 30, //Holding current torque in % (from 0 to 100)
+ 80, //Running current torque in % (from 0 to 100)
+ 40, //Holding current torque in % (from 0 to 100)
STEP_MODE_1_16, //Step mode via enum motorStepMode_t
FAST_DECAY, //Decay mode via enum motorDecayMode_t
0, //Dwelling time in ms
@@ -73,6 +73,7 @@
/* Initializing Motor Control Component. */
motor = new L6208(D2, D8, D7, D4, D5, D6, VREFA_PWM_PIN, VREFB_PWM_PIN);
if (motor->init(&init) != COMPONENT_OK) {
+ printf("error init\n\r");
exit(EXIT_FAILURE);
}
@@ -83,19 +84,20 @@
/* Attaching an error handler */
motor->attach_error_handler(&my_error_handler);
-
- //----- Change step mode to 1/4 microstepping mode
motor->set_step_mode(StepperMotor::STEP_MODE_1_4);
/* Set speed, acceleration and deceleration to scale with microstep mode */
- motor->set_max_speed(motor->get_max_speed()<<4);
- motor->set_acceleration(motor->get_acceleration()<<4);
- motor->set_deceleration(motor->get_deceleration()<<4);
+ //motor->set_max_speed(2000);
+ //motor->set_acceleration(2400);
+ //motor->set_deceleration(2400);
+ motor->set_max_speed(motor->get_max_speed()<<2);
+ motor->set_acceleration(motor->get_acceleration()<<2);
+ motor->set_deceleration(motor->get_deceleration()<<2);
/* Request to go position 9000 (quarter steps) */
while (true)
{
- motor->go_to(9000);
+ motor->go_to(3000);
motor->wait_while_active();
motor->go_to(0);