mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
doc: add lpf2 ColorDistanceSensor
Manually cherry-pick 925b6bc2474e8aa3b8d5c0d56029627f73edf029
This commit is contained in:
@@ -9,3 +9,56 @@ class Motor(CommonMotor):
|
||||
* ?/6181852: LEGO® BOOST Interactive Motor
|
||||
* TODO: Expand list with compatible devices
|
||||
"""
|
||||
|
||||
|
||||
class ColorDistanceSensor():
|
||||
"""LEGO® Power Functions 2.0 Color and Distance Sensor.
|
||||
Element ?/6182145, contained in:
|
||||
* 17101: LEGO® BOOST Creative Toolbox (2017)
|
||||
* ?: Separate part (?)
|
||||
"""
|
||||
|
||||
def __init__(self, port):
|
||||
"""ColorDistanceSensor(port)
|
||||
Arguments:
|
||||
port (Port): Port to which the sensor is connected.
|
||||
"""
|
||||
pass
|
||||
|
||||
def color(self):
|
||||
"""Measure the color of a surface.
|
||||
|
||||
:returns:
|
||||
``Color.BLACK``, ``Color.BLUE``, ``Color.GREEN``, ``Color.YELLOW``,
|
||||
``Color.RED``, ``Color.WHITE``, or ``None``.
|
||||
:rtype: :class:`Color <parameters.Color>`, or ``None`` if no color is detected.
|
||||
"""
|
||||
pass
|
||||
|
||||
def ambient(self):
|
||||
"""Measure the ambient light intensity.
|
||||
Returns:
|
||||
:ref:`percentage`: Ambient light intensity, ranging from 0 (dark) to 100 (bright).
|
||||
"""
|
||||
pass
|
||||
|
||||
def reflection(self):
|
||||
"""Measure the reflection of a surface using a red light.
|
||||
Returns:
|
||||
:ref:`percentage`: Reflection, ranging from 0.0 (no reflection) to 100.0 (high reflection).
|
||||
"""
|
||||
pass
|
||||
|
||||
def rgb(self):
|
||||
"""Measure the reflection of a surface using a red, green, and then a blue light.
|
||||
Returns:
|
||||
tuple of three :ref:`percentages <percentage>`: Reflection for red, green, and blue light, each ranging from 0.0 (no reflection) to 100.0 (high reflection).
|
||||
"""
|
||||
pass
|
||||
|
||||
def distance(self):
|
||||
"""Measure the relative distance between the sensor and an object using infrared light.
|
||||
Returns:
|
||||
:ref:`relativedistance`: Relative distance ranging from 0 (closest) to 100 (farthest).
|
||||
"""
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user