ServoKit.ContinuousServo (servo_kit v0.0.8) View Source

The abstraction of the continuous servo.

Link to this section Summary

Types

t()

Configuration options for this module.

Functions

Change the motor movement, ranging from -1.0 (full throttle reverse) to 1.0 (full throttle forward).

Link to this section Types

Specs

t() :: %ServoKit.ContinuousServo{
  driver: struct(),
  duty_cycle_mid: float(),
  duty_cycle_minmax: {float(), float()}
}

Configuration options for this module.

  • driver: A driver struct.
  • duty_cycle_minmax: A tuple of duty cycle min and max in percent.
  • duty_cycle_mid: A duty cycle in percent at which the servo stops its movement.

Link to this section Functions

Link to this function

set_throttle(state, ch, throttle)

View Source

Change the motor movement, ranging from -1.0 (full throttle reverse) to 1.0 (full throttle forward).

{:ok, state} = ServoKit.ContinuousServo.set_throttle(state, 8, 1.0)   # Full throttle forward
{:ok, state} = ServoKit.ContinuousServo.set_throttle(state, 8, -1.0)  # Full throttle reverse
{:ok, state} = ServoKit.ContinuousServo.set_throttle(state, 8, 0.0)   # Stop the movement