Wheel IDE

Online demo »

Light

Light example

This example demonstrates how to read the EV3 buttons.

IDE vs VM

When this program is executed from the IDE the behaviour is slightly different than when executed from the VM on the brick. The VM on the brick can only flash while the IDE can flash or pulse.

Code

#project "EV3 Light example"

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

#display "EV3"

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

    ; Turn the yellow light on and wait 3 seconds...
    light(LIGHT_ORANGE_FLASH)
    sleep(3000)

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

    ; Turn the green pulse light on and wait 3 seconds...
    light(LIGHT_GREEN_PULSE)
    sleep(3000)

    ; Turn the light off.
    light(LIGHT_OFF)
end
See also: Modules light