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.
The following classes are intended for general use with the devices they represent. All classes in this section are concrete (not abstract).
LED(pin, *, active_high=True, initial_value=False, pin_factory=None)
PWMLED(pin, *, active_high=True, initial_value=0, frequency=100, pin_factory=None)
RGBLED(red, green, blue, *, active_high=True, initial_value=(0, 0, 0), pwm=True, pin_factory=None)
Buzzer(pin, *, active_high=True, initial_value=False, pin_factory=None)
TonalBuzzer(pin, *, initial_value=None, mid_tone=Tone('A4'), octaves=1, pin_factory=None)
Motor(forward, backward, *, pwm=True, pin_factory=None)
PhaseEnableMotor(phase, enable, *, pwm=True, pin_factory=None)
Servo(pin, *, initial_value=0, min_pulse_width=1/1000, max_pulse_width=2/1000, frame_width=20/1000, pin_factory=None)
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)
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(pin, *, active_high=True, initial_value=False, pin_factory=None)
PWMOutputDevice(pin, *, active_high=True, initial_value=0, frequency=100, pin_factory=None)
OutputDevice(pin, *, active_high=True, initial_value=False, pin_factory=None)
GPIODevice(pin, *, pin_factory=None)