brian.sensors.NXT.LightSensorNXT
LightSensorNXT class objects
Class for interacting with NXT light sensor.
Sensor is automatically registered in the constructor of the base class and un-registered in its destructor. It can also be unregistered with the LightSensorNXT.close_sensor() function.
There can be at most one instance at any given time, of any sensor class per port in the entire program.
__init__
Initialize an NXT light sensor at the given port.
Arguments:
port
: Sensor port to which the sensor is attached.
light_value
Measures incoming light.
Arguments:
led_on
: whether the red LED should be on or off
Raises:
brian.sensors.SensorIsNotReadyError
: If the sensor is not ready.
Returns:
Value in range 0-1, with 0 being the darkest and 1 being the brightest.
light_value_raw
Measures incoming light. Raw measurement is inverted, meaning lower values correspond to brighter light.
Arguments:
led_on
: whether the red LED should be on or off
Raises:
brian.sensors.SensorIsNotReadyError
: If the sensor is not ready.
Returns:
Value in range 0-4095, with 4095 being the darkest and 0 being the brightest.