3

No matter how I rewrite a simple python 3 servo test script for the Adafruit RPI servo hat, I get the following error.

Traceback (most recent call last):
   File "servo_test.py", line 8, in <module>
      i2c = busio.I2C(board.SCL, board.SDA)
AttributeError: module 'board' has no attribute 'SCL'

I have installed all modules referenced in the servo hat documentation and "i2cdetect" has verified that the hat is properly connected. Here is my current test script (python 3):

#!/usr/bin/python
from adafruit_servokit import ServoKit
import adafruit_pca9685
import board
import busio

### board / servo hat setup ###
i2c = busio.I2C(board.SCL, board.SDA)
hat = adafruit_pca9685.pca9685(i2c)
kit = ServoKit(channels=16)

### test servo ###
kit.servo[0].angle = 60

I am running this off a Raspberry Pi model 3B with Raspbian 9.6 stretch installed. Any and all help is greatly appreciated.

harlansgs
  • 31
  • 1
  • 2

2 Answers2

5

I had the same issue due to installing board incorrectly. If like me you installed https://pypi.org/project/board/ by accident, do the following:

  • pip3 uninstall board

  • pip3 install adafruit-blinka

bigglet
  • 51
  • 1
  • 2
0

Don't install board by pip. I fixed this problem by downloading board.py from https://github.com/adafruit/Adafruit_Blinka/blob/master/src/board.py.

Young
  • 61
  • 3