How to execute python commands in a Processing script? RE: Controlling Adafruit Servo Hat

edited March 19 in Raspberry PI

Hello all,

I have a couple servos hooked up to an Adafruit 16-Channel PWM/Servo HAT on a Raspberry Pi 3 that I would like to control via Processing. Adafruit provides a python library that allows easy control of the connected servos via python commands like "setPWM(self, channel, on, off)". I can control the servos fine from the command line or python script, but have no clue how to execute these inside Processing. Any help would be much appreciated!


  • @thatdude333 This PWM/Servo controller is hooked up to the Raspberry Pi using the I2C bus. You can use the I2C class of Processing's Hardware I/O library to send command to the device. See this example for how to do so in general. For the specific commands the controller expects you would have to consult its datasheet, or - perhaps - have a peek inside the Python library to see what values get send.

Sign In or Register to comment.