Skip to content

Commit a688cf2

Browse files
committed
Add source/values and pin factories to readme
1 parent 23ec884 commit a688cf2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,48 @@ together:
5858
5959
pause()
6060
61+
You can advance to using the declarative paradigm along with provided
62+
:doc:`source tools <api_tools>` to describe the behaviour of devices and their
63+
interactions:
64+
65+
.. code:: python
66+
67+
from gpiozero import LED, MotionSensor, LightSensor
68+
from gpiozero.tools import booleanized, all_values
69+
from signal import pause
70+
71+
garden = LED(17)
72+
motion = MotionSensor(4)
73+
light = LightSensor(5)
74+
75+
garden.source = all_values(booleanized(light, 0, 0.1), motion)
76+
77+
pause()
78+
79+
See the chapter on :doc:`Source/Values <source_values>` for more information.
80+
6181
The library includes interfaces to many simple everyday components, as well as
6282
some more complex things like sensors, analogue-to-digital converters, full
6383
colour LEDs, robotics kits and more. See the `Recipes`_ chapter of the
6484
documentation for ideas on how to get started.
6585

6686
.. _Recipes: https://gpiozero.readthedocs.io/en/stable/recipes.html
6787

88+
Pin factories
89+
=============
90+
91+
GPIO Zero builds on a number of underlying pin libraries, including `RPi.GPIO`_
92+
and `pigpio`_, each with their own benefits. You can select a particular pin
93+
library to be used, either for the whole script or per-device, according to your
94+
needs. See the section on :ref:`changing the pin factory
95+
<changing-pin-factory>`.
96+
97+
.. _RPi.GPIO: https://pypi.org/project/RPi.GPIO/
98+
.. _pigpio: https://pypi.org/project/pigpio
99+
100+
A "mock pin" interface is also provided for testing purposes. Read more about
101+
this in the section on :ref:`mock pins <mock-pins>`.
102+
68103
Installation
69104
============
70105

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy