I am using a 16-Chanel PWM board to control servo motor.
And I use this code to test whether my servo is okay:
import smbus
import time
bus = smbus.SMBus(8)
address = 0x2D
def move(servo, angle):
bus.write_byte_data(address, servo, angle)
time.sleep(0.05)
while True:
for i in range(0, 90, 1):
move(8,i)
for i in range(90, 0, -1):
move(8,i)
If everything goes well, the servo would runing from 0 to 90 and 90 to 0 over and over again. But in fact the servo stopped after serveral times of loop, ended with ‘OSError: [Errno 121] Remote I/O error’. And I found it strange that if I pick up my servo and shake it, the error comes much more earlier than if I put my servo on my desk. And sometimes the code ended with another error ‘BlockingIOError: [Errno 11] Resource temporarily unavailable’.
I don’t know how to solve this problem, because I don’t know what caused this issue.