Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Abstraction for everyday GPIO components

License

NotificationsYou must be signed in to change notification settings

waveform-computing/gpio-zero

 
 

Repository files navigation

A simple interface to GPIO devices withRaspberry Pi, developed and maintainedbyBen Nuttall andDave Jones.

About

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.

Pin factories

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.

Installation

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.

Documentation

Comprehensive documentation is available athttps://gpiozero.readthedocs.io/.Please refer to theContributing andDevelopment chapters in thedocumentation for information on contributing to the project.

Issues and questions

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.

Python 2 support

Warning

GPIO Zero 1.6.x is the last to support Python 2. GPIO Zero 2.x will supportPython 3 only.

Contributors

See thecontributors page on GitHub for more info.

About

Abstraction for everyday GPIO components

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python99.6%
  • Makefile0.4%

[8]ページ先頭

©2009-2025 Movatter.jp