PCA9685.Commands (pca9685 v1.0.0)
Low-level functions for interacting directly with the PCA9685 device over I2C.
Link to this section Summary
Functions
Initialize the device and set all channels to off.
Set all 16 PWM outputs to a the same output value in a single operation.
Set a specific PWM output to the provided duty cycle.
Set's the device's PWM update frequency to the provided number of Hz.
Start a connection to the PCA9685 device over I2C.
Link to this section Types
Link to this type
address()
Specs
address() :: 0..127
Link to this type
bus()
Specs
bus() :: String.t()
Link to this type
channel()
Specs
channel() :: 0..15
Link to this type
duty_cycle()
Specs
duty_cycle() :: 0..4095
Link to this type
frequency()
Specs
frequency() :: 25..1526
Link to this section Functions
Link to this function
initialize!(pid, freq_hz)
Specs
Initialize the device and set all channels to off.
Link to this function
set_all_pwm(pid, on, off)
Specs
set_all_pwm(pid(), duty_cycle(), duty_cycle()) :: :ok | {:error, term()}
Set all 16 PWM outputs to a the same output value in a single operation.
Link to this function
set_one_pwm(pid, channel, on, off)
Specs
set_one_pwm(pid(), channel(), duty_cycle(), duty_cycle()) :: :ok | {:error, term()}
Set a specific PWM output to the provided duty cycle.
Link to this function
set_pwm_frequency(pid, freq_hz)
Specs
Set's the device's PWM update frequency to the provided number of Hz.
Calculates it with a hard coded prescale value.
Link to this function
start_link(bus, address)
Specs
Start a connection to the PCA9685 device over I2C.