pybricks.pupdevices.Remote: Add name().

https://github.com/pybricks/support/issues/404
This commit is contained in:
Laurens Valk
2021-07-28 13:41:00 +02:00
parent 1cf6f8d31b
commit 8463206f8e
2 changed files with 18 additions and 12 deletions
+1 -6
View File
@@ -7,8 +7,7 @@ Remote Control
.. autoclass:: pybricks.pupdevices.Remote
:no-members:
.. autoattribute:: pybricks.pupdevices::Remote.address
:annotation:
.. automethod:: pybricks.pupdevices::Remote.name
.. automethod:: pybricks.pupdevices::Remote.light.on
@@ -16,10 +15,6 @@ Remote Control
.. automethod:: pybricks.pupdevices::Remote.buttons.pressed
.. note::
The ``light`` and ``address`` features are not yet supported.
Examples
-------------------
+17 -6
View File
@@ -38,19 +38,30 @@ class Remote:
_Button.LEFT_PLUS,
_Button.RIGHT_PLUS
))
address = None
"""Bluetooth address of the remote, or ``None`` if it is not connected."""
def __init__(self, address=None, timeout=10000):
"""Connects to the remote.
def __init__(self, name=None, timeout=10000):
"""When you instantiate this class, the hub will search for a remote
and connect automatically.
The remote must be on and ready for a connection, as indicated by a
white blinking light.
Arguments:
device (str): Bluetooth address of the remote. If no address is
given, it connects to the first available remote that it finds.
name (str): Bluetooth name of the remote. If no name is given,
the hub connects to the first remote that it finds.
timeout (:ref:`time`): How long to search for the remote.
"""
pass
def name(self, name=None):
"""Gets or sets the Bluetooth name of the remote.
If no name is given, this method returns the current name.
Arguments:
name (str): New Bluetooth name of the remote.
"""
class TiltSensor:
"""LEGO® Powered Up Tilt Sensor."""