Skip to content

Latest commit

 

History

History
159 lines (106 loc) · 5.03 KB

api_output.rst

File metadata and controls

159 lines (106 loc) · 5.03 KB

API - Output Devices

gpiozero.output_devices

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 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

LED(pin, *, active_high=True, initial_value=False, pin_factory=None)

PWMLED

PWMLED(pin, *, active_high=True, initial_value=0, frequency=100, pin_factory=None)

RGBLED

RGBLED(red, green, blue, *, active_high=True, initial_value=(0, 0, 0), pwm=True, pin_factory=None)

Buzzer

Buzzer(pin, *, active_high=True, initial_value=False, pin_factory=None)

TonalBuzzer

TonalBuzzer(pin, *, initial_value=None, mid_tone=Tone('A4'), octaves=1, pin_factory=None)

Motor

Motor(forward, backward, *, pwm=True, pin_factory=None)

PhaseEnableMotor

PhaseEnableMotor(phase, enable, *, pwm=True, pin_factory=None)

Servo

Servo(pin, *, initial_value=0, min_pulse_width=1/1000, max_pulse_width=2/1000, frame_width=20/1000, pin_factory=None)

AngularServo

AngularServo(pin, *, initial_angle=0, min_angle=-90, max_angle=90, min_pulse_width=1/1000, max_pulse_width=2/1000, frame_width=20/1000, pin_factory=None)

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):

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

DigitalOutputDevice

DigitalOutputDevice(pin, *, active_high=True, initial_value=False, pin_factory=None)

PWMOutputDevice

PWMOutputDevice(pin, *, active_high=True, initial_value=0, frequency=100, pin_factory=None)

OutputDevice

OutputDevice(pin, *, active_high=True, initial_value=False, pin_factory=None)

GPIODevice

GPIODevice(pin, *, pin_factory=None)