Webots Reference Manual - chapter 3 - section 32

Webots Reference Manual


3.32 LED

Derived from Device.

LED {
  MFColor   color   [ 1 0 0 ]  # [0,1]
  SFBool    gradual FALSE      # for gradual color display and RBG LEDs
}

3.32.1 Description

The LED node is used to model a light emitting diode (LED). The light produced by an LED can be used for debugging or informational purposes. The resulted color is applied only on the first child of the LED node. If the first child is a Shape node, the emissiveColor field of its Material node is altered. If the first child is a Light node, its color field is altered. Otherwise, if the first child is a Group node, a recursive search is applied on this node in order to find which color field must be modified, so every Light, Shape and Group node is altered according to the previous rules.

3.32.2 Field Summary

3.32.3 LED Functions



NAME

   wb_led_set - turn an LED on or off

SYNOPSIS [C++] [Java] [Python] [Matlab]

  #include <webots/led.h>

  void wb_led_set(WbDeviceTag tag, int value);

DESCRIPTION

wb_led_set() switches an LED on or off, possibly changing its color. If the value parameter is 0, the LED is turned off. Otherwise, it is turned on.

In the case of a non-gradual LED (gradual field set to FALSE), if the value parameter is 1, the LED is turned on using the first color specified in the color field of the corresponding LED node. If the value parameter is 2, the LED is turned on using the second color specified in the color field of the LED node, and so on. The value parameter should not be greater than the size of the color field of the corresponding LED node.

In the case of a monochromatic LED (gradual field set to TRUE and color field containing exactly one color), the value parameter indicates the intensity of the LED in the range 0 (off) to 255 (maximum intensity).

In the case of an RGB LED (gradual field set to TRUE and color field containing an empty list), the value parameter indicates the RGB color of the LED in the range 0 (off or black) to 0xffffff (white). The format is R8G8B8: The most significant 8 bits (left hand side) indicate the red level (between 0x00 and 0xff). Bits 8 to 15 indicate the green level and the least significant 8 bits (right hand side) indicate the blue level. For example, 0xff0000 is red, 0x00ff00 is green, 0x0000ff is blue, 0xffff00 is yellow, etc.

release 7.0.2
Copyright © 2012 Cyberbotics Ltd. All right reserved.