GO Plus motor stop
-
Hi all,
is the code in
https://github.com/m5stack/GoPlus/blob/master/src/src.ino
The actual code that it is shipped with? Apart from the fact that it is a bit of a mess, if i read it right then the dc motors should stop if you send a speed of 0
//duty_motor_num = motor_num;
if(motor_speed == 0){
if(motor_num == 0){digitalWrite(IN_0, 0); digitalWrite(IN_1, 0); duty_trun0 = trun; duty_speed0 = motor_speed; //MsTimer2::stop(); //time_flag = 0; duty0 = 0; duty_motor_0_flag = 0; //analogWrite(IN_0, 0); //analogWrite(IN_1, 0); }else if(motor_num == 2) { // digitalWrite(IN_2, 0); //digitalWrite(IN_3, 0); digitalWrite(IN_2, 0); digitalWrite(IN_3, 0); duty_trun1 = trun; duty_speed1 = motor_speed; //MsTimer2::stop(); //time_flag = 0; duty1 = 0; duty_motor_1_flag = 0; // analogWrite(IN_2, 0); // analogWrite(IN_3, 0); }
}
it seems like it shoudl first check if the motor speed is 0 and if that is true then check which motor is send. And if the motorspeed <> 0 then it should look at the direction etc.
But the motor never seems to stop... Can anybody confirm that this is a true?
-
@percramer you have to use a value just below the motors stall value.
To make a motor hard stop you perposely stall the motor however, you have to stall and release the motor as soon as it stops or current will ramp up and possibly damage components.