mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
This makes the user code easier to read: brick.buttons() brick.buttons.pressed() It also opens up possibility to add features in the future such as: brick.buttons.released() # return which buttons are not pressed brick.buttons.clicked() # return which buttons were clicked since we last checked This follows the same style as the new light API: some devices have specific instances of a KeyPad class. A good example that nicely demonstrates the concept is the LPF2 RemoteControl, which has instances of a ColorLight and a KeyPad. It's added in this commit.
10 lines
204 B
Python
10 lines
204 B
Python
"""LEGO® MINDSTORMS® EV3 Brick."""
|
|
|
|
from ._common import Speaker, Display, Battery, ColorLight, KeyPad
|
|
|
|
sound = Speaker()
|
|
display = Display()
|
|
battery = Battery()
|
|
light = ColorLight()
|
|
buttons = KeyPad()
|