From 1eac0972ac7270a30a44a34a125c1d9e2836f3e9 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Fri, 5 Jun 2020 15:30:03 +0200 Subject: [PATCH] api/hubs: add CPlusHub --- doc/api/hubs.rst | 2 ++ doc/api/hubs_cplushub.inc | 15 +++++++++++++++ pybricks/hubs.py | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 doc/api/hubs_cplushub.inc diff --git a/doc/api/hubs.rst b/doc/api/hubs.rst index 03a3cfa..23380fa 100644 --- a/doc/api/hubs.rst +++ b/doc/api/hubs.rst @@ -38,3 +38,5 @@ Select your programmable hub using the buttons below. .. figure:: ../api/images/cplushub.png :height: 15 em + + .. include:: hubs_cplushub.inc diff --git a/doc/api/hubs_cplushub.inc b/doc/api/hubs_cplushub.inc new file mode 100644 index 0000000..a1e833a --- /dev/null +++ b/doc/api/hubs_cplushub.inc @@ -0,0 +1,15 @@ +.. autoclass:: pybricks.hubs.CPlusHub + :no-members: + + .. rubric:: Using the hub status light + + .. automethod:: pybricks.hubs::CPlusHub.light.on + + .. automethod:: pybricks.hubs::CPlusHub.light.off + + .. rubric:: Using the battery + + .. automethod:: pybricks.hubs::CPlusHub.battery.voltage + + .. automethod:: pybricks.hubs::CPlusHub.battery.current + diff --git a/pybricks/hubs.py b/pybricks/hubs.py index ba27612..2476b91 100644 --- a/pybricks/hubs.py +++ b/pybricks/hubs.py @@ -26,3 +26,9 @@ class CityHub: """LEGO® Powered Up City Hub.""" battery = _Battery() light = _ColorLight() + + +class CPlusHub: + """LEGO® Technic Control+ Hub.""" + battery = _Battery() + light = _ColorLight()