Continuous Rotation Servos
CRServoEx wraps a CRServo exactly like a ServoEx wraps a Servo but implements Powerable instead of Positionable.
Declarations
You can declare CRServoEx in the following manner, much like a normal ServoEx:
kotlin
val crServoEx: CRServoEx = CRServoEx("cr_servo_name")
// Alternatively
val crServoEx: CRServoEx = CRServoEx { crServo }
// Alternatively
val crServoEx: CRServoEx = CRServoEx(crServo)Additionally you can pass a cache tolerance (default is 0.01), exactly like a normal servo.
kotlin
var crServoEx = CRServoEx("cr_servo_name", cacheTolerance)
var crServoEx = CRServoEx(cacheTolerance) { crServo }
var crServoEx = CRServoEx(crServo, cacheTolerance)Usage
CRServoEx has only a power property to set or get the power of the motor. Like a MotorEx the power can vary from -1 to 1.
kotlin
crServoEx.power = 0.0 // To turn off
crServoEx.power = -1.0 // To spin in reverse fully
crServoEx.power = 0.5 // To spin forward partially