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

Class InfraredSensor

source code

Class that represents an infrared sensor.

Instance Methods [hide private]
 
__init__(self, id, **kwargs)
Creates an infrared sensor at given port.
source code
 
_setup(self, robot) source code
int
getValue(self)
Checks, if reflected light is detected.
source code
 
getSensorState(self) source code
 
setSensorState(self, state) source code
 
getSensorType(self) source code
 
onActivated(self) source code
 
onPassivated(self) source code
 
_checkRobot(self) source code
Method Details [hide private]

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

source code 

Creates an infrared sensor at given port. For the Pi2Go the following infrared sensors are used: id = 0: front center; id = 1: front left; id = 2: front right; id = 3: line left; id = 4: line right. The following global constants are defined: IR_CENTER = 0, IR_LEFT = 1, IR_RIGHT = 2, IR_LINE_LEFT = 3, IR_LINE_RIGHT = 4

Parameters:
  • id - sensor identifier

getValue(self)

source code 

Checks, if reflected light is detected.

Returns: int
1, if the sensor detects reflected light; otherwise 0