I need code to stop servo?
Well, you already have :
Code:
# Function to stop the servodef stop_servo(channel): try: pca.channels[channel].duty_cycle = 0 # Set duty cycle to 0 to stop the servo except Exception as e: print("Error stopping servo:", e)
Have you tested that function to check that it does what you expect?
And having defined the stop_servo() function, you don't seem to make any use of it?
I agree with the suggestion to carry out tests on the separate components of your project.
Statistics: Posted by B.Goode — Wed Apr 10, 2024 5:19 pm