brian.sensors.Sensor
Sensor class objects
Base Sensor class
__init__
Initialize a EV3 sensor class at the given port.
Arguments:
port
: Sensor port to which the sensor is attached (sensors.SensorPort.S1-sensors.SensorPort.S4).sensor_type
: Type of the sensor which is attached. sensor_port_probe.AutoDetect.ANALOG_P1 corresponds to LightSensorNXT and TouchSensorNXT sensor_port_probe.AutoDetect.ANALOG_P6 corresponds to TouchSensor sensor_port_probe.AutoDetect.PROTOCOL_UART_EV3 corresponds to ColorSensor, GyroSensor and UltrasonicSensor
Raises:
SensorPortAlreadyInUse
: When trying to create new sensor on port that is already in use.
__del__
close_sensor
is_connected
Returns:
True iff sensor is connected and not in the process of rebooting, False otherwise
is_ready
Ready-state indicates that the attempt to read values will give valid results.
Example reasons for invalid results:
- Sensor is rebooting or not initiated yet
- Sensor is changing modes and the change is not finished yet
- Connected sensor is incompatible with this handler (e.g. wrong type of sensor is connected)
Returns:
True iff values are ready for the next read, False otherwise