ServoKit (servo_kit v0.2.0) View Source

Use PCA9685 PWM/Servo Controller in Elixir

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Maps a given value in one range to another range.

Link to this section Types

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

map(number(), {number(), number()}, {number(), number()}) :: float()

Maps a given value in one range to another range.

Examples

iex> ServoKit.map(0, {0, 180}, {2.5, 12.5})
2.5

iex> ServoKit.map(45, {0, 180}, {2.5, 12.5})
5.0

iex> ServoKit.map(90, {0, 180}, {2.5, 12.5})
7.5

iex> ServoKit.map(180, {0, 180}, {2.5, 12.5})
12.5

iex> ServoKit.map(0, {-1.0, 1.0}, {2.5, 12.5})
7.5

iex> ServoKit.map(-1, {-1.0, 1.0}, {2.5, 12.5})
2.5

iex> ServoKit.map(1, {-1.0, 1.0}, {2.5, 12.5})
12.5
Link to this function

set_pwm_duty_cycle(pid \\ __MODULE__, duty_cycle, list)

View Source
Link to this function

set_pwm_frequency(pid \\ __MODULE__, freq_hz)

View Source