Skip to content

Commit

Permalink
api/pupdevices: add Powered Up Light
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Jun 8, 2020
1 parent c536081 commit 8084039
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/api/diagram_source/pupsensors.ldr
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
1 15 600 -266 158 -1 0 0 0 -1 0 0 0 1 u9218c01.dat
1 15 1130 -280 240 1 0 0 0 1 0 0 0 1 37316.dat
1 15 1290 -280 220 1 0 0 0 1 0 0 0 1 37308.dat
1 0 690 -312 530 0 0 1 0 1 0 -1 0 0 22168.dat
Binary file added doc/api/images/light.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions doc/api/pupdevices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,16 @@ Force Sensor
.. automethod:: pybricks.pupdevices::RemoteControl.light.off
.. automethod:: pybricks.pupdevices::RemoteControl.buttons.pressed
Light
^^^^^^^^^^^^^^^^^^^^^^^^^

.. figure:: ../api/images/light.png
:width: 90 %

.. autoclass:: pybricks.pupdevices.Light
:no-members:

.. automethod:: pybricks.pupdevices.Light.on

.. automethod:: pybricks.pupdevices.Light.off
2 changes: 1 addition & 1 deletion pybricks/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class Light:
"""Control a single-color light."""

def on(self, brightness=100):
"""Turn on the light at the specified brightness.
"""Turns on the light at the specified brightness.
Arguments:
brightness (:ref:`brightness`):
Expand Down
15 changes: 14 additions & 1 deletion pybricks/pupdevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from ._common import (KeyPad as _KeyPad, Accelerometer as _Accelerometer,
ColorLight as _ColorLight, Motor as _Motor,
LightArray as _LightArray)
LightArray as _LightArray, Light as _Light)


class Motor(_Motor):
Expand Down Expand Up @@ -311,3 +311,16 @@ def touched(self):
"""

pass


class Light(_Light):
"""LEGO® Powered Up Light."""

def __init__(self, port):
"""
Arguments:
port (Port): Port to which the device is connected.
"""
pass

0 comments on commit 8084039

Please sign in to comment.