ServoKit

Hex.pmAPI docsCI

Drive PCA9685 PWM/Servo Controller using Elixir

Installation

You can install this library by adding servo_kit to your list of dependencies in mix.exs:

def deps do
[
{:servo_kit, "~> 0.0.4"}
]
end

Examples

# Initialize a driver.
{:ok, driver} = ServoKit.PCA9685.new(%{i2c_bus_name: "i2c-1"})
# Set the frequency to 50Hz (period: 20ms).
{:ok, driver} = ServoKit.PCA9685.set_pwm_frequency(driver, 50)
# Set the duty cycle of Channel 0 to 7.5%.
{:ok, driver} = ServoKit.PCA9685.set_pwm_duty_cycle(driver, 0, 7.5)