NextCRServo

open class NextCRServo(initializer: () -> CRServoImplEx, val cacheTolerance: Double = 0.01)

Lightweight wrapper around a CRServoImplEx that provides a more user-friendly interface for controlling continuous-rotation servo power and direction.

Example:

val crServo = NextCRServo("intakeServo")
crServo.power = 0.75
crServo.direction = DcMotorSimple.Direction.REVERSE

Parameters

initializer

A function returning the backing CRServoImplEx. It will be invoked lazily the first time the servo is accessed.

cacheTolerance

Tolerance used by the Caching delegate for power updates; defaults to 0.01.

Inheritors

Constructors

Link copied to clipboard
constructor(initializer: () -> CRServoImplEx, cacheTolerance: Double = 0.01)
constructor(module: LynxModule, port: Int, cacheTolerance: Double = 0.01)

Constructor to create a NextCRServo using a LynxModule and port number.

constructor(name: String, cacheTolerance: Double = 0.01)

Properties

Link copied to clipboard
Link copied to clipboard

Direction of the servo. Setting this to DcMotorSimple.Direction.REVERSE causes positive power values to spin the servo the opposite way, and vice versa.

Link copied to clipboard

Power applied to the servo, in the range -1.0, 1.0.

Functions

Link copied to clipboard
fun disable()

Disables the PWM output of the associated servo.

Link copied to clipboard
fun enable()

Enables the PWM output of the associated servo.

Link copied to clipboard

Sets the servo's direction to DcMotorSimple.Direction.REVERSE, causing positive power values to spin the servo the opposite way.