RGBHeadlight

class RGBHeadlight(name: String, cacheTolerance: Double = 0.01) : NextServo

Wrapper for the goBILDA PWM RGB Headlight Module.

The module behaves like a servo, different PWM positions correspond to different colors/patterns.

Example:

val headlight = RGBHeadlight("headlights")

headlight.setColor(RGBHeadlight.Color.RED)

headlight.setBrightness(0.8)

Parameters

name

The name of the servo in the hardware map.

cacheTolerance

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

Constructors

Link copied to clipboard
constructor(name: String, cacheTolerance: Double = 0.01)

Types

Link copied to clipboard

Available colors/patterns for the headlights

Properties

Link copied to clipboard
Link copied to clipboard

The commanded servo position in the range [0.0, 1.0].

Link copied to clipboard

Provides access to the servo's PWM range configuration.

Functions

Link copied to clipboard
fun disable()

Disables PWM output for the underlying servo.

Link copied to clipboard
fun enable()

Enables PWM output for the underlying servo.

Link copied to clipboard
fun off()

Turns headlights off.

Link copied to clipboard
fun setBrightness(brightness: Double)

Sets brightness by scaling the PWM range.

Link copied to clipboard

Sets the headlight color/pattern.

fun setColor(pwm: Double)

Sets the headlight color/pattern using a raw PWM position.

Link copied to clipboard
fun setPwmRange(lower: Double, upper: Double)

Sets the PWM range of the associated servo.