You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 30, 2019. It is now read-only.
I have a 16 channel servo driver (https://www.adafruit.com/products/815) that I connected to my Raspberry Pi rev 2, and now I'm trying to send data over I2C to make the motor work.
$ git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
$ cd Adafruit-Raspberry-Pi-Python-Code
$ cd Adafruit_PWM_Servo_Driver
It also says to change the self.i2c = Adafruit_I2C(address) line, for the rev 2 Raspberry Pi:
If you have a second revision raspberry Pi, you'll need to update the default I2C port. In the file Adafruit_PWM_Servo_Driver/Adafruit_PWM_Servo_Driver.py
change
self.i2c = Adafruit_I2C(address)
to
self.i2c = Adafruit_I2C(address, bus=smbus.SMBus(1))
You also need to add import smbus to the top of the file.
When I follow these instructions and then run "sudo python Servo_Example.py", I get this error:
[pi@raspberrypi] {master} ~/adafruit/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver$ sudo python Servo_Example.py
Traceback (most recent call last):
File "Servo_Example.py", line 12, in <module>
pwm = PWM(0x40, debug=True)
File "/home/pi/adafruit/Adafruit-Raspberry-Pi-Python-Code/Adafruit_PWM_Servo_Driver/Adafruit_PWM_Servo_Driver.py", line 31, in __init__
self.i2c = Adafruit_I2C(address, bus=smbus.SMBus(1))
TypeError: __init__() got an unexpected keyword argument 'bus'
It looks like the Adafruit_I2C constructor doesn't let me pass in a bus? Do you know how I can get this working on my rev 2 RPi? Thanks!