LightSensor

LightSensor describes a light sensor. A LightSensor instance contains the following attributes:

Table A.4. Light sensor's attributes:

NameDescription
valThe light level measured (from 0 to 1).
mode

"Ambiant" measures the ambiant light.

"Reflector" lights on a led and measures the reflection.

"Normal" returns the raw value

portThe port where the servo is plugged. It can be 1, 2, 3 or 4. You can change the value while the server is running. Beware, if you change the port, that will free the old port (so you will be able to create another device on it) and will busy the new one (so you won't be able to create another device on it).
init(port_, mode_)

The UObject constructor.

port_ is a port name. (See previous attribute port).

mode_ is a mode name. (See previous attribute mode).

Example:

light = LightSensor.new(1, "Ambiant");