mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
@@ -127,10 +127,10 @@ Like the ``GPIOZERO_PIN_FACTORY`` value, these can be exported from your
|
|||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
The astute and mischievous reader may note that it is possible to mix
|
The astute and mischievous reader may note that it is possible to mix
|
||||||
strictly local pin implementations, e.g. using ``RPiGPIOPin`` for one pin,
|
factories, e.g. using ``RPiGPIOFactory`` for one pin, and ``NativeFactory``
|
||||||
and ``NativePin`` for another. This is unsupported, and if it results in
|
for another. This is unsupported, and if it results in your script
|
||||||
your script crashing, your components failing, or your Raspberry Pi turning
|
crashing, your components failing, or your Raspberry Pi turning into an
|
||||||
into an actual raspberry pie, you have only yourself to blame.
|
actual raspberry pie, you have only yourself to blame.
|
||||||
|
|
||||||
Sensible uses of multiple pin factories are given in :doc:`remote_gpio`.
|
Sensible uses of multiple pin factories are given in :doc:`remote_gpio`.
|
||||||
|
|
||||||
|
|||||||
@@ -161,10 +161,11 @@ class NativeFactory(LocalPiFactory):
|
|||||||
|
|
||||||
You can construct native pin instances manually like so::
|
You can construct native pin instances manually like so::
|
||||||
|
|
||||||
from gpiozero.pins.native import NativePin
|
from gpiozero.pins.native import NativeFactory
|
||||||
from gpiozero import LED
|
from gpiozero import LED
|
||||||
|
|
||||||
led = LED(NativePin(12))
|
factory = NativeFactory()
|
||||||
|
led = LED(12, pin_factory=factory)
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(NativeFactory, self).__init__()
|
super(NativeFactory, self).__init__()
|
||||||
|
|||||||
@@ -46,20 +46,21 @@ class PiGPIOFactory(PiFactory):
|
|||||||
|
|
||||||
You can construct pigpio pins manually like so::
|
You can construct pigpio pins manually like so::
|
||||||
|
|
||||||
from gpiozero.pins.pigpio import PiGPIOPin
|
from gpiozero.pins.pigpio import PiGPIOFactory
|
||||||
from gpiozero import LED
|
from gpiozero import LED
|
||||||
|
|
||||||
led = LED(PiGPIOPin(12))
|
factory = PiGPIOFactory()
|
||||||
|
led = LED(12, pin_factory=factory)
|
||||||
|
|
||||||
This is particularly useful for controlling pins on a remote machine. To
|
This is particularly useful for controlling pins on a remote machine. To
|
||||||
accomplish this simply specify the host (and optionally port) when
|
accomplish this simply specify the host (and optionally port) when
|
||||||
constructing the pin::
|
constructing the pin::
|
||||||
|
|
||||||
from gpiozero.pins.pigpio import PiGPIOPin
|
from gpiozero.pins.pigpio import PiGPIOFactory
|
||||||
from gpiozero import LED
|
from gpiozero import LED
|
||||||
from signal import pause
|
|
||||||
|
|
||||||
led = LED(PiGPIOPin(12, host='192.168.0.2'))
|
factory = PiGPIOFactory(host='192.168.0.2')
|
||||||
|
led = LED(12, pin_factory=factory)
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ class RPiGPIOFactory(LocalPiFactory):
|
|||||||
from gpiozero.pins.rpigpio import RPiGPIOFactory
|
from gpiozero.pins.rpigpio import RPiGPIOFactory
|
||||||
from gpiozero import LED
|
from gpiozero import LED
|
||||||
|
|
||||||
led = LED(RPiGPIOPin(12))
|
factory = RPiGPIOFactory()
|
||||||
|
led = LED(12, pin_factory=factory)
|
||||||
|
|
||||||
.. _RPi.GPIO: https://pypi.python.org/pypi/RPi.GPIO
|
.. _RPi.GPIO: https://pypi.python.org/pypi/RPi.GPIO
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -40,10 +40,11 @@ class RPIOFactory(LocalPiFactory):
|
|||||||
|
|
||||||
You can construct RPIO pins manually like so::
|
You can construct RPIO pins manually like so::
|
||||||
|
|
||||||
from gpiozero.pins.rpio import RPIOPin
|
from gpiozero.pins.rpio import RPIOFactory
|
||||||
from gpiozero import LED
|
from gpiozero import LED
|
||||||
|
|
||||||
led = LED(RPIOPin(12))
|
factory = RPIOFactory()
|
||||||
|
led = LED(12, pin_factory=factory)
|
||||||
|
|
||||||
.. _RPIO: https://pythonhosted.org/RPIO/
|
.. _RPIO: https://pythonhosted.org/RPIO/
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user