File: api_output.rst

package info (click to toggle)
gpiozero 2.0.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,192 kB
  • sloc: python: 15,355; makefile: 246
file content (136 lines) | stat: -rw-r--r-- 2,721 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.. GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
..
.. Copyright (c) 2015-2021 Dave Jones <dave@waveform.org.uk>
.. Copyright (c) 2019 Ben Nuttall <ben@bennuttall.com>
.. Copyright (c) 2016 Andrew Scheller <github@loowis.durge.org>
..
.. SPDX-License-Identifier: BSD-3-Clause

====================
API - Output Devices
====================

.. module:: gpiozero.output_devices

.. currentmodule:: gpiozero

These output device component interfaces have been provided for simple use of
everyday components. Components must be wired up correctly before use in code.

.. note::

    All GPIO pin numbers use Broadcom (BCM) numbering by default. See the
    :ref:`pin-numbering` section for more information.


Regular Classes
===============

The following classes are intended for general use with the devices they
represent. All classes in this section are concrete (not abstract).


LED
---

.. autoclass:: LED
    :members: on, off, toggle, blink, pin, is_lit, value


PWMLED
------

.. autoclass:: PWMLED
    :members: on, off, toggle, blink, pulse, pin, is_lit, value


RGBLED
------

.. autoclass:: RGBLED
    :members: on, off, toggle, blink, pulse, red, green, blue, is_lit, color, value


Buzzer
------

.. autoclass:: Buzzer
    :members: on, off, toggle, beep, pin, is_active, value


TonalBuzzer
-----------

.. autoclass:: TonalBuzzer
    :members: play, stop, octaves, min_tone, mid_tone, max_tone, tone, is_active, value


Motor
-----

.. autoclass:: Motor
    :members: forward, backward, reverse, stop, is_active, value


PhaseEnableMotor
----------------

.. autoclass:: PhaseEnableMotor
    :members: forward, backward, reverse, stop, is_active, value


Servo
-----

.. autoclass:: Servo
    :members:


AngularServo
------------

.. autoclass:: AngularServo
    :members: angle, max_angle, min_angle, min, max, mid, is_active, value


Base Classes
============

The classes in the sections above are derived from a series of base classes,
some of which are effectively abstract. The classes form the (partial)
hierarchy displayed in the graph below (abstract classes are shaded lighter
than concrete classes):

.. image:: images/output_device_hierarchy.*

The following sections document these base classes for advanced users that wish
to construct classes for their own devices.


DigitalOutputDevice
-------------------

.. autoclass:: DigitalOutputDevice
    :members: on, off, blink, value


PWMOutputDevice
---------------

.. autoclass:: PWMOutputDevice
    :members: on, off, blink, pulse, toggle, frequency, is_active, value


OutputDevice
------------

.. autoclass:: OutputDevice
    :members:


GPIODevice
----------

.. autoclass:: GPIODevice
    :members:
    :noindex: