ServoKit

CI

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.2"}
  ]
end

Examples

# Start the LCD driver and get the initial state.
{:ok, state} = ServoKit.PCA9685.start(%{i2c_bus_name: "i2c-1"})

# Set the frequency to 50Hz (period: 20ms).
ServoKit.PCA9685.set_pwm_frequency(state, 50)

# Set the duty cycle of Channel 0 to 7.5%.
ServoKit.PCA9685.set_pwm_duty_cycle(state, 0, 7.5)