[Maybe Solved]Lag is found using ledc() to control servo

human890209
Posts: 48
Joined: Wed Aug 15, 2018 8:56 am

[Maybe Solved]Lag is found using ledc() to control servo

Postby human890209 » Sat Jun 29, 2019 3:39 am

Hi,
I'm using ledc() to control my servos. I'm using 2 360° servos to replace the motors to make a simple robot.
Lately, I've found that when I set the duty to 0 to stop my robot, the robot still moving. I use some code to print the duty of ledc() after I set it, the number is set to 0, but the servo is still turning which means the duty of the actual squarewave is not updated.
Now I make my code calling ledc() each loop to update the duty to make it produce the physical effect, but this could make the servo control having unstable lag.
I'm using a Servo and an MPU to make my robot head pointing to a fixed Yaw Angle, and this lag of ledc() can't get a good result when the body movement is complicated.

[Maybe Solved]
I can't reproduce the lag now, maybe I used an old version of ESP-Arduino. Don't know if this is solved by a newer version of ESP-Arduino or ESP-IDF.

Who is online

Users browsing this forum: MSN [Bot] and 5 guests