mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-15 19:16:15 +00:00
We were hiding this under a toggle menu to reduce the page size of the hubs module. Now that each hub is on its own page, this is no longer necessary. In turn, this makes it easier to document the same method for other hubs.
212 lines
6.6 KiB
ReStructuredText
212 lines
6.6 KiB
ReStructuredText
MINDSTORMS EV3 Brick
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
.. figure:: ../../api/images/ev3brick.png
|
|
:height: 15 em
|
|
|
|
.. autoclass:: pybricks.hubs.EV3Brick
|
|
:no-members:
|
|
|
|
.. rubric:: Using the buttons
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.buttons.pressed
|
|
|
|
.. rubric:: Using the brick status light
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.light.on
|
|
|
|
.. toggle-header::
|
|
:header: **Show/hide example**
|
|
|
|
**Example: Turn the light on and change the color.**
|
|
|
|
.. literalinclude::
|
|
../../../examples/ev3/light_color/main.py
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.light.off
|
|
|
|
.. rubric:: Using the speaker
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.speaker.beep
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.speaker.play_notes
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.speaker.play_file
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.speaker.say
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.speaker.set_speech_options
|
|
|
|
.. toggle-header::
|
|
:header: **Show/hide available languages and voices**
|
|
|
|
You can choose the following languages:
|
|
|
|
- ``'af'``: Afrikaans
|
|
- ``'an'``: Aragonese
|
|
- ``'bg'``: Bulgarian
|
|
- ``'bs'``: Bosnian
|
|
- ``'ca'``: Catalan
|
|
- ``'cs'``: Czech
|
|
- ``'cy'``: Welsh
|
|
- ``'da'``: Danish
|
|
- ``'de'``: German
|
|
- ``'el'``: Greek
|
|
- ``'en'``: English (default)
|
|
- ``'en-gb'``: English (United Kingdom)
|
|
- ``'en-sc'``: English (Scotland)
|
|
- ``'en-uk-north'``: English (United Kingdom, Northern)
|
|
- ``'en-uk-rp'``:
|
|
English (United Kingdom, Received Pronunciation)
|
|
- ``'en-uk-wmids'``: English (United Kingdom, West Midlands)
|
|
- ``'en-us'``: English (United States)
|
|
- ``'en-wi'``: English (West Indies)
|
|
- ``'eo'``: Esperanto
|
|
- ``'es'``: Spanish
|
|
- ``'es-la'``: Spanish (Latin America)
|
|
- ``'et'``: Estonian
|
|
- ``'fa'``: Persian
|
|
- ``'fa-pin'``: Persian
|
|
- ``'fi'``: Finnish
|
|
- ``'fr-be'``: French (Belgium)
|
|
- ``'fr-fr'``: French (France)
|
|
- ``'ga'``: Irish
|
|
- ``'grc'``: Greek
|
|
- ``'hi'``: Hindi
|
|
- ``'hr'``: Croatian
|
|
- ``'hu'``: Hungarian
|
|
- ``'hy'``: Armenian
|
|
- ``'hy-west'``: Armenian (Western)
|
|
- ``'id'``: Indonesian
|
|
- ``'is'``: Icelandic
|
|
- ``'it'``: Italian
|
|
- ``'jbo'``: Lojban
|
|
- ``'ka'``: Georgian
|
|
- ``'kn'``: Kannada
|
|
- ``'ku'``: Kurdish
|
|
- ``'la'``: Latin
|
|
- ``'lfn'``: Lingua Franca Nova
|
|
- ``'lt'``: Lithuanian
|
|
- ``'lv'``: Latvian
|
|
- ``'mk'``: Macedonian
|
|
- ``'ml'``: Malayalam
|
|
- ``'ms'``: Malay
|
|
- ``'ne'``: Nepali
|
|
- ``'nl'``: Dutch
|
|
- ``'no'``: Norwegian
|
|
- ``'pa'``: Punjabi
|
|
- ``'pl'``: Polish
|
|
- ``'pt-br'``: Portuguese (Brazil)
|
|
- ``'pt-pt'``: Portuguese (Portugal)
|
|
- ``'ro'``: Romanian
|
|
- ``'ru'``: Russian
|
|
- ``'sk'``: Slovak
|
|
- ``'sq'``: Albanian
|
|
- ``'sr'``: Serbian
|
|
- ``'sv'``: Swedish
|
|
- ``'sw'``: Swahili
|
|
- ``'ta'``: Tamil
|
|
- ``'tr'``: Turkish
|
|
- ``'vi'``: Vietnamese
|
|
- ``'vi-hue'``: Vietnamese (Hue)
|
|
- ``'vi-sgn'``: Vietnamese (Saigon)
|
|
- ``'zh'``: Mandarin Chinese
|
|
- ``'zh-yue'``: Cantonese Chinese
|
|
|
|
You can choose the following voices:
|
|
|
|
- ``'f1'``: female variant 1
|
|
- ``'f2'``: female variant 2
|
|
- ``'f3'``: female variant 3
|
|
- ``'f4'``: female variant 4
|
|
- ``'f5'``: female variant 5
|
|
- ``'m1'``: male variant 1
|
|
- ``'m2'``: male variant 2
|
|
- ``'m3'``: male variant 3
|
|
- ``'m4'``: male variant 4
|
|
- ``'m5'``: male variant 5
|
|
- ``'m6'``: male variant 6
|
|
- ``'m7'``: male variant 7
|
|
- ``'croak'``: croak
|
|
- ``'whisper'``: whisper
|
|
- ``'whisperf'``: female whisper
|
|
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.speaker.set_volume
|
|
|
|
|
|
.. rubric:: Using the screen
|
|
|
|
.. |this image| replace:: the screen
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.clear
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_text
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.print
|
|
|
|
.. toggle-header::
|
|
:header: **Show/hide example**
|
|
|
|
**Example: Say hello... in several ways.**
|
|
|
|
.. raw:: latex
|
|
|
|
\begin{CJK}{UTF8}{gbsn}
|
|
|
|
.. literalinclude::
|
|
../../../examples/ev3/screen_print/main.py
|
|
|
|
.. raw:: latex
|
|
|
|
\end{CJK}
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.set_font
|
|
|
|
**Example:** See example in :meth:`print`.
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.load_image
|
|
|
|
.. toggle-header::
|
|
:header: **Show/hide example**
|
|
|
|
**Example: Show an image on the screen.**
|
|
|
|
.. literalinclude::
|
|
../../../examples/ev3/screen_image/main.py
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_image
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_pixel
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_line
|
|
|
|
.. toggle-header::
|
|
:header: **Show/hide example**
|
|
|
|
**Example: Draw some shapes on the screen.**
|
|
|
|
.. literalinclude::
|
|
../../../examples/ev3/screen_draw/main.py
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_box
|
|
|
|
**Example:** See example in :meth:`draw_line`.
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_circle
|
|
|
|
**Example:** See example in :meth:`draw_line`.
|
|
|
|
.. autoattribute:: pybricks.hubs::EV3Brick.screen.width
|
|
|
|
.. autoattribute:: pybricks.hubs::EV3Brick.screen.height
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.screen.save
|
|
|
|
|
|
.. rubric:: Using the battery
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.battery.voltage
|
|
|
|
.. automethod:: pybricks.hubs::EV3Brick.battery.current
|