Picar-x/example/servo_zeroing.py fails with an error

Raspberry Pi 4
RasPiOS Buster (32-bit)
PiCarX Order: #100005863

Followed the steps as documented here: Servo Adjust — SunFounder picar-x documentation

While running command: sudo python3 servo_zeroing.py
Get the following error:
/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: Your system is neon capable but pygame was not built with support for it. The performance of some of your blits could be adversely affected. Consider enabling compile time detection with environment variables like PYGAME_DETECT_AVX2=1 if you are compiling without cross compilation.
return f(*args, **kwds)
Set servo to zero
Traceback (most recent call last):
File “servo_zeroing.py”, line 13, in
Servo(i).angle(10)
File “/usr/local/lib/python3.7/dist-packages/robot_hat-1.0.4-py3.7.egg/robot_hat/servo.py”, line 12, in init
self.pwm.period(4095)
AttributeError: ‘int’ object has no attribute ‘period’

Connecting the servo results in nothing.

Issue Resolved.
I re-installed robot-hat with the v2.0 branch switch:
git clone -b v2.0 GitHub - sunfounder/robot-hat: Robot Hat python library

1 Like