Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A simple interface to GPIO devices with Raspberry Pi
, developed and
maintained by Ben Nuttall
and Dave Jones
_.
.. _Raspberry Pi: https://www.raspberrypi.org/ .. _Ben Nuttall: https://github.com/bennuttall .. _Dave Jones: https://github.com/waveform80
Component interfaces are provided to allow a frictionless way to get started with physical computing:
.. code:: python
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:
.. code:: python
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 to describe the behaviour of devices and their interactions:
.. code:: python
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.
.. _Source/Values: https://gpiozero.readthedocs.io/en/stable/source_values.html
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.
.. _Recipes: https://gpiozero.readthedocs.io/en/stable/recipes.html
GPIO Zero builds on a number of underlying pin libraries, including RPi.GPIO
_
and pigpio
, each with their own benefits. 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
.
.. _RPi.GPIO: https://pypi.org/project/RPi.GPIO .. _pigpio: https://pypi.org/project/pigpio .. _changing the pin factory: https://gpiozero.readthedocs.io/en/stable/api_pins.html#changing-the-pin-factory
A "mock pin" interface is also provided for testing purposes. Read more about
this in the section on mock pins
_.
.. _mock pins: https://gpiozero.readthedocs.io/en/stable/api_pins.html#mock-pins
GPIO Zero is installed by default in the Raspberry Pi OS desktop image,
available from raspberrypi.org
. To install on Raspberry Pi OS Lite or other
operating systems, including for PCs using remote GPIO, see the Installing
chapter.
.. _raspberrypi.org: https://www.raspberrypi.org/software/ .. _Installing: https://gpiozero.readthedocs.io/en/stable/installing.html
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.
.. _Contributing: https://gpiozero.readthedocs.io/en/stable/contributing.html .. _Development: https://gpiozero.readthedocs.io/en/stable/development.html
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
_.
.. _issue on GitHub: https://github.com/gpiozero/gpiozero/issues/new .. _GitHub discussion board: https://github.com/gpiozero/gpiozero/discussions .. _Raspberry Pi Stack Exchange: https://raspberrypi.stackexchange.com/ .. _Raspberry Pi Forums: https://www.raspberrypi.org/forums/
Alex Chan
_Alex Eames
_Andrew Scheller
_Barry Byford
_Cameron Davidson-Pilon
_Carl Monk
_Claire Pollard
_Clare Macrae
_Dan Jackson
_Daniele Procida
_damosurfer
_David Glaude
_Delcio Torres
_Edward Betts
_Fatih Sarhan
_Fangchen Li
_G.S.
_gnicki
_Ian Harcombe
_Jack Wearden
_Jeevan M R
_Josh Thorpe
_Kyle Morgan
_Linus Groh
_Mahallon
_Maksim Levental
_Martchus
_Martin O'Hanlon
_Mike Kazantsev
_Paulo Mateus
_Phil Howard
_Philippe Muller
_Rick Ansell
_Rimas Misevičius
_Robert Erdin
_Russel Winder
_Ryan Walmsley
_Schelto van Doorn
_Sofiia Kosovan
_Steve Amor
_Stewart Adcock
_Thijs Triemstra
_Tim Golden
_Yisrael Dov Lebow
_See the contributors page
_ on GitHub for more info.
.. _Alex Chan: https://github.com/gpiozero/gpiozero/commits?author=alexwlchan .. _Alex Eames: https://github.com/gpiozero/gpiozero/commits?author=raspitv .. _Andrew Scheller: https://github.com/gpiozero/gpiozero/commits?author=lurch .. _Barry Byford: https://github.com/gpiozero/gpiozero/commits?author=ukBaz .. _Cameron Davidson-Pilon: https://github.com/gpiozero/gpiozero/commits?author=CamDavidsonPilon .. _Carl Monk: https://github.com/gpiozero/gpiozero/commits?author=ForToffee .. _Chris R: https://github.com/gpiozero/gpiozero/commits?author=chrisruk .. _Claire Pollard: https://github.com/gpiozero/gpiozero/commits?author=tuftii .. _Clare Macrae: https://github.com/gpiozero/gpiozero/commits?author=claremacrae .. _Dan Jackson: https://github.com/gpiozero/gpiozero/commits?author=e28eta .. _Daniele Procida: https://github.com/evildmp .. _Dariusz Kowalczyk: https://github.com/gpiozero/gpiozero/commits?author=darton .. _damosurfer: https://github.com/gpiozero/gpiozero/commits?author=damosurfer .. _David Glaude: https://github.com/gpiozero/gpiozero/commits?author=dglaude .. _Delcio Torres: https://github.com/gpiozero/gpiozero/commits?author=delciotorres .. _Edward Betts: https://github.com/gpiozero/gpiozero/commits?author=edwardbetts .. _Fatih Sarhan: https://github.com/gpiozero/gpiozero/commits?author=f9n .. _Fangchen Li: https://github.com/gpiozero/gpiozero/commits?author=fangchenli .. _G.S.: https://github.com/gpiozero/gpiozero/commits?author=gszy .. _gnicki: https://github.com/gpiozero/gpiozero/commits?author=gnicki2000 .. _Ian Harcombe: https://github.com/gpiozero/gpiozero/commits?author=MrHarcombe .. _Jack Wearden: https://github.com/gpiozero/gpiozero/commits?author=NotBobTheBuilder .. _Jeevan M R: https://github.com/gpiozero/gpiozero/commits?author=jee1mr .. _Josh Thorpe: https://github.com/gpiozero/gpiozero/commits?author=ThorpeJosh .. _Kyle Morgan: https://github.com/gpiozero/gpiozero/commits?author=knmorgan .. _Linus Groh: https://github.com/gpiozero/gpiozero/commits?author=linusg .. _Mahallon: https://github.com/gpiozero/gpiozero/commits?author=Mahallon .. _Maksim Levental: https://github.com/gpiozero/gpiozero/commits?author=makslevental .. _Martchus: https://github.com/gpiozero/gpiozero/commits?author=Martchus .. _Martin O'Hanlon: https://github.com/martinohanlon/commits?author=martinohanlon .. _Mike Kazantsev: https://github.com/gpiozero/gpiozero/commits?author=mk-fg .. _Paulo Mateus: https://github.com/gpiozero/gpiozero/commits?author=SrMouraSilva .. _Phil Howard: https://github.com/gpiozero/gpiozero/commits?author=Gadgetoid .. _Philippe Muller: https://github.com/gpiozero/gpiozero/commits?author=pmuller .. _Rick Ansell: https://github.com/gpiozero/gpiozero/commits?author=ricksbt .. _Rimas Misevičius: https://github.com/gpiozero/gpiozero/commits?author=rmisev .. _Robert Erdin: https://github.com/gpiozero/gpiozero/commits?author=roberterdin .. _Russel Winder: https://github.com/russel .. _Ryan Walmsley: https://github.com/gpiozero/gpiozero/commits?author=ryanteck .. _Schelto van Doorn: https://github.com/gpiozero/gpiozero/commits?author=goloplo .. _Sofiia Kosovan: https://github.com/gpiozero/gpiozero/commits?author=SofiiaKosovan .. _Steve Amor: https://github.com/gpiozero/gpiozero/commits?author=SteveAmor .. _Stewart Adcock: https://github.com/gpiozero/gpiozero/commits?author=stewartadcock .. _Thijs Triemstra: https://github.com/gpiozero/gpiozero/commits?author=thijstriemstra .. _Tim Golden: https://github.com/gpiozero/gpiozero/commits?author=tjguk .. _Yisrael Dov Lebow: https://github.com/gpiozero/gpiozero/commits?author=yisraeldov
.. _contributors page: https://github.com/gpiozero/gpiozero/graphs/contributors
FAQs
A simple interface to GPIO devices with Raspberry Pi
We found that gpiozero demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.