Module LightSensor :: Class LightSensor
[hide private]
[frames] | no frames]

Class LightSensor

source code

Class that represents an light sensor.

Instance Methods [hide private]
 
__init__(self, id, **kwargs)
Creates a light sensor instance with given id.
source code
int
getValue(self)
Returns the current intensity value (0..1000).
source code
 
getTriggerLevel(self) source code
 
setTriggerLevel(self, level) source code
 
getSensorState(self) source code
 
setSensorState(self, state) source code
 
getSensorType(self) source code
 
onBright(self, v) source code
 
onDark(self, v) source code
 
_readADC(self, channel) source code
 
_checkRobot(self) source code
Method Details [hide private]

__init__(self, id, **kwargs)
(Constructor)

source code 

Creates a light sensor instance with given id. IDs: 0: front left, 1: front right, 2: rear left, 3: rear right The following global constants are defined: LS_FRONT_LEFT = 0, LS_FRONT_RIGHT = 1, LS_REAR_LEFT = 2, LS_REAR_RIGHT = 3.

Parameters:
  • id - the LightSensor identifier

getValue(self)

source code 

Returns the current intensity value (0..1000).

Returns: int
the measured light intensity