- Notifications
You must be signed in to change notification settings - Fork1
Abstraction for everyday GPIO components
License
waveform-computing/gpio-zero
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple interface to GPIO devices withRaspberry Pi, developed and maintainedbyBen Nuttall andDave Jones.
Component interfaces are provided to allow a frictionless way to get startedwith physical computing:
fromgpiozeroimportLEDfromtimeimportsleepled=LED(17)whileTrue:led.on()sleep(1)led.off()sleep(1)
With very little code, you can quickly get going connecting your componentstogether:
fromgpiozeroimportLED,Buttonfromsignalimportpauseled=LED(17)button=Button(3)button.when_pressed=led.onbutton.when_released=led.offpause()
You can advance to using the declarative paradigm along with providedto describe the behaviour of devices and their interactions:
fromgpiozeroimportOutputDevice,MotionSensor,LightSensorfromgpiozero.toolsimportbooleanized,all_valuesfromsignalimportpausegarden=OutputDevice(17)motion=MotionSensor(4)light=LightSensor(5)garden.source=all_values(booleanized(light,0,0.1),motion)pause()
See the chapter onSource/Values for more information.
The library includes interfaces to many simple everyday components, as well assome more complex things like sensors, analogue-to-digital converters, fullcolour LEDs, robotics kits and more. See theRecipes chapter of thedocumentation for ideas on how to get started.
GPIO Zero builds on a number of underlying pin libraries, includingRPi.GPIOandpigpio, each with their own benefits. You can select a particular pinlibrary to be used, either for the whole script or per-device, according to yourneeds. See the section onchanging the pin factory.
A "mock pin" interface is also provided for testing purposes. Read more aboutthis in the section onmock pins.
GPIO Zero is installed by default in the Raspberry Pi OS desktop image,available fromraspberrypi.org. To install on Raspberry Pi OS Lite or otheroperating systems, including for PCs using remote GPIO, see theInstallingchapter.
Comprehensive documentation is available athttps://gpiozero.readthedocs.io/.Please refer to theContributing andDevelopment chapters in thedocumentation for information on contributing to the project.
If you have a feature request or bug report, please open anissue on GitHub.If you have a question or need help, this may be better suited to ourGitHubdiscussion board, theRaspberry Pi Stack Exchange or theRaspberry PiForums.
Warning
GPIO Zero 1.6.x is the last to support Python 2. GPIO Zero 2.x will supportPython 3 only.
- Alex Chan
- Alex Eames
- Andrew Scheller
- Barry Byford
- Carl Monk
- Claire Pollard
- Clare Macrae
- Dan Jackson
- Daniele Procida
- damosurfer
- David Glaude
- Delcio Torres
- Edward Betts
- Fatih Sarhan
- G.S.
- 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
- Robert Erdin
- Russel Winder
- Ryan Walmsley
- Schelto van Doorn
- Sofiia Kosovan
- Steve Amor
- Stewart Adcock
- Thijs Triemstra
- Tim Golden
- Yisrael Dov Lebow
See thecontributors page on GitHub for more info.
About
Abstraction for everyday GPIO components
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Languages
- Python99.6%
- Makefile0.4%