Skip to main content

gpiozero

A simple interface to GPIO devices with Raspberry Pi, developed and maintained by Ben Nuttall and Dave Jones.

About

Component interfaces are provided to allow a frictionless way to get started with physical computing:

from gpiozero import LED
from time import sleep

led = LED(17)

while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)

With very little code, you can quickly get going connecting your components together:

from gpiozero import LED, Button
from signal import pause

led = LED(17)
button = Button(3)

button.when_pressed = led.on
button.when_released = led.off

pause()

You can advance to using the declarative paradigm along with provided source tools to describe the behaviour of devices and their interactions:

from gpiozero import OutputDevice, MotionSensor, LightSensor
from gpiozero.tools import booleanized, all_values
from signal import pause

garden = OutputDevice(17)
motion = MotionSensor(4)
light = LightSensor(5)

garden.source = all_values(booleanized(light, 0, 0.1), motion)

pause()

See the chapter on Source/Values for more information.

The library includes interfaces to many simple everyday components, as well as some more complex things like sensors, analogue-to-digital converters, full colour LEDs, robotics kits and more. See the Recipes chapter of the documentation for ideas on how to get started.

Pin factories

GPIO Zero builds on a number of underlying pin libraries. You can select a particular pin library to be used, either for the whole script or per-device, according to your needs. See the section on changing the pin factory.

A “mock pin” interface is also provided for testing purposes. Read more about this in the section on mock pins.

Installation

GPIO Zero is installed by default in the Raspberry Pi OS desktop images, available from raspberrypi.com. To install on Raspberry Pi OS Lite or other operating systems, including for PCs using remote GPIO or mock pins, see the Installing chapter.

Documentation

Comprehensive documentation is available at https://gpiozero.readthedocs.io/. Please refer to the Contributing and Development chapters in the documentation for information on contributing to the project.

Issues and questions

If you have a feature request or bug report, please open an issue on GitHub. If you have a question or need help, this may be better suited to our GitHub discussion board, the Raspberry Pi Stack Exchange or the Raspberry Pi Forums.

Contributors

See the contributors page on GitHub for more info.

Metadata

Release files for gpiozero 2.0.1.post3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpiozero 2.0.1.post3
File Size Uploaded
gpiozero-2.0.1.post3.tar.gz 168.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gpiozero 2.0.1.post3
File Interpreter ABI Platform
gpiozero-2.0.1.post3-py3-none-any.whl Python 3 none any Details

Total release size: 319.9 kB

Release files / gpiozero-2.0.1.post3.tar.gz

Download URL gpiozero-2.0.1.post3.tar.gz
Size 168.4 kB
Tags Source
SHA-256 checksum
How to use checksums
745feab6df463ac2e9de10c67e2dd9f396e668ba4e281e92381d6c460100a8f7
BLAKE2b-256 checksum
How to use checksums
6763864a3c36842cf7b05808aadf906763a024a1b13f2a4c8144e3163de91255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / gpiozero-2.0.1.post3-py3-none-any.whl

Download URL gpiozero-2.0.1.post3-py3-none-any.whl
Size 151.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d491734803a9bc6036602e6b8bbd73fb25c33da88de0fcd11a40e890b8bc2d3b
BLAKE2b-256 checksum
How to use checksums
45cbec5917b454b2e82874769a348dc74cfcec5b447bf1061c827edea9702451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

2.0.1.post3 This release

2 release files

2.0.1

2 release files

2.0

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page