EV3 Analog Sensor

Note

This class is only available on EV3.

../_images/sensor_rj12_brown.png
class AnalogSensor(port)

Generic or custom analog sensor.

Parameters

port (Port) – Port to which the sensor is connected.

voltage()

Measures analog voltage.

Returns

Analog voltage.

Return type

voltage: mV

resistance()

Measures resistance.

This value is only meaningful if the analog device is a passive load such as a resistor or thermistor.

Returns

Resistance of the analog device.

Return type

resistance: Ω

active()

Sets sensor to active mode. This sets pin 5 of the sensor port to high.

This is used in some analog sensors to control a switch. For example, if you use the NXT Light Sensor as a custom analog sensor, this method will turn the light on. From then on, voltage() returns the raw reflected light value.

passive()

Sets sensor to passive mode. This sets pin 5 of the sensor port to low.

This is used in some analog sensors to control a switch. For example, if you use the NXT Light Sensor as a custom analog sensor, this method will turn the light off. From then on, voltage() returns the raw ambient light value.