I am following the Adafruit page regarding the ServoHat for the Raspberry Pi. I am unclear what module to import to get the PWM class. This is the page about using the PWM class: https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/library-reference

They begin by running pwm = PWM(0x40). However, they don't specify what to import in order to get the PWM class. Any help would be appreciated.

  • Run python in a shell (type python followed by return). Then import the Adafruit modules one by one. Use help(module name) to find the one which has a PWM method.
    – joan
    Aug 5, 2019 at 10:42
  • @joan I used help(adafruit_servokit) and help(adafruit_pca9685) and neither of those modules contain a class called PWM. Aug 5, 2019 at 11:45
  • @Richard Wessels, Are you using this guide? cdn-learn.adafruit.com/downloads/pdf/… The comment on page 14 of installing servo-kit makes me laugh: ... from your command line run the following command: sudo pip3 install adafruit-circuitpython-servokit, If your default Python is version 3 you may need to run 'pip' instead.
    – tlfong01
    Aug 5, 2019 at 12:50
  • @Richard Wessels, I read the AdaFruit ServoHat/Bonnet user guide and found their Adafruit PCA9685 driver interesting.(1) Adafruit PCA9685 Driver Doc circuitpython.readthedocs.io/projects/pca9685/en/latest/… (2)( Adafruit PCA9685 Driver Source circuitpython.readthedocs.io/projects/pca9685/en/latest/… I am thinking of using this driver to do the PWM LED project described in Page 14 of the tutorial. I have a cheapy TaoBao/AliExpress PCA9685 module which I think is software compatible with the expensive AdaFruit module.
    – tlfong01
    Aug 5, 2019 at 13:17
  • @tlfong01 Yes, I am using that guide. Aug 5, 2019 at 13:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.