Freenove / Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi

Apply to FNK0043
Other
133 stars 148 forks source link

servo setup problem #52

Open Bahauldien opened 5 months ago

Bahauldien commented 5 months ago

while assembling the car, when i connect the servos and open the server file on terminal & run the servo.py to set them up to 90 i get this message + error: Now servos will rotate to 90°. If they have already been at 90°, nothing will be observed. Please keep the program running when installing the servos. After that, you can press ctrl-C to end the program. Traceback (most recent call last): File "/home/baha/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi/Code/Server/servo.py", line 34, in pwm=Servo() ^^^^^^^ File "/home/baha/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi/Code/Server/servo.py", line 5, in init self.PwmServo = PCA9685(0x40, debug=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/baha/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi/Code/Server/PCA9685.py", line 29, in init self.bus = smbus.SMBus(1) ^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory

im kinda noob with python and linux but im pretty sure i have the right directory open and i connected everything correctly so far

Shaynee-MO commented 5 months ago

Please run the command to install smbus and try again. sudo apt-get install python3-smbus

HockeyD8 commented 5 months ago

I have the same problem, and it’s not solved by reinstalling python3-smbus.

fire-eggs commented 5 months ago

@HockeyD8 , @Shaynee-MO : Just to confirm: is the I2C interface enabled on your Raspberry Pi? The FileNotFoundError message may occur if the I2C interface is not enabled.

How to enable I2C is discussed in "Step 2 Configuration" on page 37 of the PDF tutorial. Or, here's one tutorial that walks through the process of enabling it via the command line utility.