Note: If you are using a BrickPi rather than an EV3, you will need to manually configure the ports before interacting with your sensors. See the example here. There are other common issues specific to the BrickPi; check out Common Issues.
These classes derive from :py:class:`ev3dev2.sensor.Sensor` and provide helper functions specific to the corresponding sensor type. Each provides sensible property accessors for the main functionality of the sensor.
.. currentmodule:: ev3dev2.sensor.lego
.. autoclass:: TouchSensor
:members:
:show-inheritance:
.. autoclass:: ColorSensor
:members:
:show-inheritance:
.. autoclass:: UltrasonicSensor
:members:
:show-inheritance:
.. autoclass:: GyroSensor
:members:
:show-inheritance:
.. autoclass:: InfraredSensor
:members:
:show-inheritance:
.. autoclass:: SoundSensor
:members:
:show-inheritance:
.. autoclass:: LightSensor
:members:
:show-inheritance:
This is the base class all the other sensor classes are derived from. You generally want to use one of the other classes instead, but if your sensor doesn't have a dedicated class, this is will let you interface with it as a generic device.
.. currentmodule:: ev3dev2.sensor
.. autoclass:: Sensor
:members: