mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-07-28 04:07:46 +00:00
doc: initial content for hubs
This is cherry-picking from 86e9b0b0fc15b019406bee43718fbdf3416dcf0d
This commit is contained in:
@@ -257,10 +257,6 @@ class Motor():
|
||||
class Display():
|
||||
"""Show images or text on a display."""
|
||||
|
||||
def __init__(self, device_type):
|
||||
"""Device-specific display initialization."""
|
||||
pass
|
||||
|
||||
def clear(self):
|
||||
"""Clear everything on the display."""
|
||||
pass
|
||||
@@ -317,10 +313,6 @@ class Display():
|
||||
class Speaker():
|
||||
"""Play beeps and sound files using a speaker."""
|
||||
|
||||
def __init__(self, device_type):
|
||||
"""Device specific speaker initialization."""
|
||||
pass
|
||||
|
||||
def beep(self, frequency=500, duration=100, volume=30):
|
||||
"""Play a beep/tone.
|
||||
|
||||
@@ -375,23 +367,11 @@ class Speaker():
|
||||
class Battery():
|
||||
"""Get the status of a battery."""
|
||||
|
||||
def __init__(self, device_type):
|
||||
"""Battery-specific initialization."""
|
||||
pass
|
||||
|
||||
def voltage(self):
|
||||
"""Get the voltage of the battery.
|
||||
|
||||
Returns:
|
||||
:ref:`voltage`: Battery voltage.
|
||||
|
||||
Examples::
|
||||
|
||||
# Play a warning sound when the battery voltage
|
||||
# is below 7 Volt (7000 mV = 7V)
|
||||
if brick.battery.voltage() < 7000:
|
||||
brick.sound.beep()
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@@ -48,6 +48,6 @@ def light(color):
|
||||
pass
|
||||
|
||||
|
||||
sound = Speaker('EV3')
|
||||
display = Display('EV3')
|
||||
battery = Battery('EV3')
|
||||
sound = Speaker()
|
||||
display = Display()
|
||||
battery = Battery()
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
"""LEGO® Power Functions 2.0 Hub 4."""
|
||||
|
||||
from _common import Battery
|
||||
|
||||
battery = Battery()
|
||||
@@ -0,0 +1,5 @@
|
||||
"""LEGO® Power Functions 2.0 Move Hub."""
|
||||
|
||||
from _common import Battery
|
||||
|
||||
battery = Battery()
|
||||
Reference in New Issue
Block a user