I have difficulty in controlling a MG995 continuous motor. For I know I can control the speed of the motor as writing servo1.write(p) , where the value of p changes the speed of the motor. When the value of p is set to 90 then the motor stops ,whereas 0 and 180 values allows it to move in the top speed in C.W and Anti C.W direction respectively. ...........** I had difficulty in writing a code where I can rotate the servo motor for 180 degrees then rotating back again to 0 and whenever my ultrasonic sensor finds any object the servo should stop at that point for further action. ** ........ (I think this value could be useful :Operating speed: 0.2 s/60º (4.8 V), 0.16 s/60º (6 V))

  • You want to rotate at any speed that you want, or you want to rotate to any angle that you want? – Majenko Jul 30 at 9:16
  • I want to rotate at a specific angle . – Aditya Raj Jul 30 at 9:30
  • 2
    Then you need some form of feedback from the motor's shaft to know what angle it is at. Normally if you want an angle then you don't want a continuous rotation servo. – Majenko Jul 30 at 9:32
  • I have a feeling that by using time functions we can rotate it at any angle .If my calculations are correct then for every angle it takes 3 milliseconds to turn.Well I don't know if we can use this – Aditya Raj Jul 30 at 9:37
  • 1
    what are you trying to do ... your question says nothing about the end goal of your project – jsotola Jul 30 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.