Wheel IDE

Online demo »

Light

This file contains a procedures to control the EV3 or Powered Up light.

Constants

The light module.
Source: lib/modules/light.whl, line: 9
MODULE_LIGHT3

Module call to control the light.
Source: lib/modules/light.whl, line: 12
LIGHT_UPDATE0

EV3 Light colors and modes.
Source: lib/modules/light.whl, line: 15
LIGHT_OFF0
LIGHT_GREEN1
LIGHT_RED2
LIGHT_ORANGE3
LIGHT_GREEN_FLASH4
LIGHT_RED_FLASH5
LIGHT_ORANGE_FLASH6
LIGHT_GREEN_PULSE7
LIGHT_RED_PULSE8
LIGHT_ORANGE_PULSE9

Powered Up light colors.
Source: lib/modules/light.whl, line: 27
LIGHT_PU_BLACK0
LIGHT_PU_PINK1
LIGHT_PU_PURPLE2
LIGHT_PU_BLUE3
LIGHT_PU_LIGHT_BLUE4
LIGHT_PU_CYAN5
LIGHT_PU_GREEN6
LIGHT_PU_YELLOW7
LIGHT_PU_ORANGE8
LIGHT_PU_RED9
LIGHT_PU_WHITE10
LIGHT_PU_NONE255

Spike light colors.
Source: lib/modules/light.whl, line: 41
LIGHT_SPIKE_PINK1
LIGHT_SPIKE_VIOLET2
LIGHT_SPIKE_BLUE3
LIGHT_SPIKE_AZURE4
LIGHT_SPIKE_CYAN5
LIGHT_SPIKE_GREEN6
LIGHT_SPIKE_YELLOW7
LIGHT_SPIKE_ORANGE8
LIGHT_SPIKE_RED9
LIGHT_SPIKE_WHITE10

Procedures

lightLayer
Source: lib/modules/light.whl, line: 53

Turn the light on or off.

proc lightLayer(number layer, number mode)
Parameters:
NameTypeDescription
layernumberThe layer, only applies to Powered Up and Spike.
modenumberThe color and pattern.

light
Source: lib/modules/light.whl, line: 61

Turn the light on or off.

proc light(number mode)
Parameters:
NameTypeDescription
modenumberThe color and pattern.

With the light module you can control the EV3 light.

#include "lib/modules/standard.whl"
#include "lib/modules/light.whl"

proc main()
    ; Turn the red light on and wait 1 second...
    light(LIGHT_RED, LIGHT_FLASH_OFF)
    sleep(1000)

    ; Turn the yellow light on and wait 3 seconds...
    light(LIGHT_ORANGE, LIGHT_FLASH_ON)
    sleep(3000)

    ; Turn the yellow light on and wait 1 second...
    light(LIGHT_ORANGE, LIGHT_FLASH_OFF)
    sleep(1000)

    ; Turn the light off.
    light(LIGHT_OFF, LIGHT_FLASH_OFF)
end