ServoKit.PCA9685 (servo_kit v0.0.1) View Source
Controls the PCA9685 PWM Servo Driver from Elixir. See PCA9685 Datasheet
Link to this section Summary
Functions
Performs the software reset. See Datasheet 7.1.4 and 7.6.
Sets a single PWM channel or all PWM channels by specifying when to switch on and when to switch off in a period. These values must be between 0 and 4095.
Sets a single PWM channel or all PWM channels by specifying the duty cycle in percent.
Set the PWM frequency to the provided value in hertz.
Puts board into sleep mode.
Initialize the PCA9685.
Wakes board from sleep.
Link to this section Functions
Performs the software reset. See Datasheet 7.1.4 and 7.6.
iex> ServoKit.PCA9685.reset(state)
Sets a single PWM channel or all PWM channels by specifying when to switch on and when to switch off in a period. These values must be between 0 and 4095.
iex> ServoKit.PCA9685.set_pwm(state, 0, {0, 2000})
iex> ServoKit.PCA9685.set_pwm(state, :all, {0, 2000})
Sets a single PWM channel or all PWM channels by specifying the duty cycle in percent.
iex> ServoKit.PCA9685.set_pwm_duty_cycle(state, 0, 50.0)
iex> ServoKit.PCA9685.set_pwm_duty_cycle(state, :all, 50.0)
Set the PWM frequency to the provided value in hertz.
iex> ServoKit.PCA9685.set_pwm_frequency(state, 50)
Puts board into sleep mode.
iex> ServoKit.PCA9685.sleep(state)
Initialize the PCA9685.
iex> {:ok, state} = ServoKit.PCA9685.start(%{i2c_bus_name: "i2c-1"})
Wakes board from sleep.
iex> ServoKit.PCA9685.wake_up(state)