🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    GO Plus motor stop

    Scheduled Pinned Locked Moved Modules
    2 Posts 2 Posters 5.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      percramer
      last edited by

      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?

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A Offline
        ajb2k3 @percramer
        last edited by

        @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.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post