NextServo
open class NextServo @JvmOverloads constructor(initializer: () -> ServoImplEx, val cacheTolerance: Double = 0.01, direction: NextMotor.Direction = NextMotor.Direction.FORWARD)
Lightweight wrapper around a ServoImplEx that provides a more user-friendly interface for controlling servo position and PWM range. controls how sensitive the position caching delegate is to small changes.
Example:
val servo = NextServo("armServo")
servo.position = 0.5
servo.setPwmRange(500.0, 2500.0)Content copied to clipboard
Parameters
initializer
A function returning the backing ServoImplEx. It will be invoked lazily the first time the servo is accessed.
cacheTolerance
Tolerance used by the Caching delegate for position updates; defaults to 0.01.
direction
The initial direction of the servo defined by the user as a NextMotor.Direction which defaults to NextMotor.Direction.FORWARD
Inheritors
Constructors
Link copied to clipboard
constructor(initializer: () -> ServoImplEx, cacheTolerance: Double = 0.01, direction: NextMotor.Direction = NextMotor.Direction.FORWARD)
constructor(module: NextLynxModule, port: Int, cacheTolerance: Double = 0.01, direction: NextMotor.Direction = NextMotor.Direction.FORWARD)
Constructor to create a NextServo using a LynxModule and port number.
constructor(name: String, cacheTolerance: Double = 0.01, direction: NextMotor.Direction = NextMotor.Direction.FORWARD)
Constructor to create a NextServo using configuration name