mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
doc/*/light: update to double colon reference
This lets us drop the instances hack
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. automethod:: pybricks._instances.light.on
|
||||
.. automethod:: pybricks.hubs::CityHub.light.on
|
||||
|
||||
.. automethod:: pybricks._instances.light.off
|
||||
.. automethod:: pybricks.hubs::CityHub.light.off
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
.. rubric:: Using the brick status light
|
||||
|
||||
.. automethod:: pybricks._instances.light.on
|
||||
.. automethod:: pybricks.hubs::EV3Brick.light.on
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide example**
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
.. literalinclude:: ../../pybricks-projects/snippets/ev3/light_color/main.py
|
||||
|
||||
.. automethod:: pybricks._instances.light.off
|
||||
.. automethod:: pybricks.hubs::EV3Brick.light.off
|
||||
|
||||
.. rubric:: Using the speaker
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. automethod:: pybricks._instances.light.on
|
||||
.. automethod:: pybricks.hubs::MoveHub.light.on
|
||||
|
||||
.. automethod:: pybricks._instances.light.off
|
||||
.. automethod:: pybricks.hubs::MoveHub.light.off
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ Color and Distance Sensor
|
||||
it off. If you use the sensor to measure something afterwards, the light
|
||||
automatically turns back on at the default color for that sensing method.
|
||||
|
||||
.. automethod:: pybricks._instances.light.on
|
||||
.. automethod:: pybricks.pupdevices::ColorDistanceSensor.light.on
|
||||
|
||||
.. automethod:: pybricks._instances.light.off
|
||||
.. automethod:: pybricks.pupdevices::ColorDistanceSensor.light.off
|
||||
|
||||
|
||||
Tilt Sensor
|
||||
@@ -98,8 +98,8 @@ Remote Control
|
||||
.. autoclass:: pybricks.pupdevices.RemoteControl
|
||||
:no-members:
|
||||
|
||||
.. automethod:: pybricks._instances.light.on
|
||||
.. automethod:: pybricks.pupdevices::RemoteControl.light.on
|
||||
|
||||
.. automethod:: pybricks._instances.light.off
|
||||
.. automethod:: pybricks.pupdevices::RemoteControl.light.off
|
||||
|
||||
.. automethod:: pybricks._instances.buttons.pressed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Sphinx workaround to document instance attributes such as self.light"""
|
||||
|
||||
from .builtins import Motor, Battery, ColorLight, KeyPad, LightArray
|
||||
from .builtins import Motor, KeyPad, LightArray
|
||||
from .parameters import Direction, Stop
|
||||
from types import ModuleType
|
||||
|
||||
@@ -15,12 +15,11 @@ def make_instance(classdef):
|
||||
return mod
|
||||
|
||||
|
||||
light = make_instance(ColorLight)
|
||||
|
||||
lights = make_instance(LightArray)
|
||||
|
||||
buttons = make_instance(KeyPad)
|
||||
|
||||
|
||||
class Motor(Motor):
|
||||
"""Generic class to control motors with built-in rotation sensors."""
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ class Motor(CommonMotor):
|
||||
class RemoteControl():
|
||||
"""LEGO® Powered Up Bluetooth Remote Control/Handset (6214560)"""
|
||||
|
||||
light = ColorLight()
|
||||
buttons = KeyPad()
|
||||
|
||||
def __init__(self, device=None, timeout=10000):
|
||||
"""Connect the handset to the hub.
|
||||
|
||||
@@ -22,8 +25,7 @@ class RemoteControl():
|
||||
timeout (:ref:`time`): The amount of time before giving up
|
||||
searching.
|
||||
"""
|
||||
self.buttons = KeyPad()
|
||||
self.light = ColorLight()
|
||||
pass
|
||||
|
||||
|
||||
class TiltSensor(Accelerometer):
|
||||
@@ -41,13 +43,14 @@ class TiltSensor(Accelerometer):
|
||||
class ColorDistanceSensor():
|
||||
"""LEGO® Powered Up Color and Distance Sensor (?/6182145)"""
|
||||
|
||||
light = ColorLight()
|
||||
|
||||
def __init__(self, port):
|
||||
"""ColorDistanceSensor(port)
|
||||
|
||||
Arguments:
|
||||
port (Port): Port to which the sensor is connected.
|
||||
"""
|
||||
self.light = ColorLight()
|
||||
pass
|
||||
|
||||
def color(self):
|
||||
|
||||
Reference in New Issue
Block a user