bricknil.sensor.light

All LED/light output devices

Classes

LED(name[, port, capabilities]) Changes the LED color on the Hubs.
Light(name[, port, capabilities]) Connects to the external light.

Members

class bricknil.sensor.light.LED(name, port=None, capabilities=[])[source]

Bases: bricknil.sensor.peripheral.Peripheral

Changes the LED color on the Hubs:

@attach(LED, name='hub_led')

self.hub_led.set_output(Color.red)

set_color(color: bricknil.const.Color)[source]

Converts a Color enumeration to a color value

class bricknil.sensor.light.Light(name, port=None, capabilities=[])[source]

Bases: bricknil.sensor.peripheral.Peripheral

Connects to the external light.

Example:

@attach(Light, name='light')

And then within the run body, use:

await self.light.set_brightness(brightness)
set_brightness(brightness: int)[source]

Sets the brightness of the light.

Parameters:brightness (int) – A value between -100 and 100 where 0 is off and -100 or 100 are both maximum brightness.