battlecore::lights

The lights module controls the device RGB lights: setting individual or many lights, managing maximum brightness, committing changes, and running sweep and flash effects. Include its declarations with include "./battlecore/lights.bst";.

setOne

Sets a single light by index to the given colour and brightness.

native void battlecore::lights.setOne (int lightIndex, int r, int g, int b, int brightness = 255);

setMany

Sets many lights at once from a two-dimensional array of values.

native void battlecore::lights.setMany (int[][] values);

getMaxBrightness

Returns the current maximum brightness.

native int battlecore::lights.getMaxBrightness ();

setMaxBrightness

Sets the maximum brightness.

native void battlecore::lights.setMaxBrightness (int newValue);

allOff

Turns all lights off.

native void battlecore::lights.allOff ();

commit

Commits pending light changes to the hardware.

native void battlecore::lights.commit ();

sweep

Runs a sweep effect across the lights in the given colour over a duration, optionally in reverse.

native void battlecore::lights.sweep (int r, int g, int b, int a, int duration, bool forward = true);

flash

Flashes the lights in the given colour a number of times with configurable on/off durations.

native void battlecore::lights.flash (int r, int g, int b, int a, int times = 3, int onDurationMs = 200, int offDurationMs = 100);