Motor_power_adjust

as the title
i tried using analogWrite()
but failed
tks

btw is sg dc motor tks

Translating is appears to be an ultrasound transceiver. Without the code it is just a wild guess. My first suggestion is to remove the delays.

1 Like

Welcome to the forum

Arduino code is much easier to deal with if you post it here rather than providing a link to where it is held.

Please post it here using code tags when you do

Which Arduino are you using and what exactly does "failed" mean ?

You don't use analogWrite() with a servo.
What are you trying to do?

bro u are nice
i have another thouhgt by changing the delay to control the speed of motor spin!
thx!

for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(1/distance);                       // waits depend on distance
  }

thx u for reminding!
the failure means when i make the ultrasound transceiver
and the target distance to 0 ,the motor still move!
(it should not for pwm is 0)
type:uno

i try to adjust the pwm (voltage of motor) in order to change the power of
ball throwing depend on distance detected

Your delay idea should work.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.