Files
python-gpiozero/docs/api_input.rst
Dave Jones 759a6a58e6 Fix #140, fix #69, fix #185
This PR adds a software SPI implementation. Firstly this removes the
absolute necessity for spidev (#140), which also means when it's not
present things still work (effectively fixes #185), and also enables any
four pins to be used for SPI devices (which don't require the hardware
implementation).

The software implementation is simplistic but still supports clock
polarity and phase, select-high, and variable bits per word. However it
doesn't allow precise speeds to be implemented because it just wibbles
the clock as fast as it can (which being pure Python isn't actually that
fast).

Finally, because this PR involves creating a framework for "shared"
devices (like SPI devices with multiple channels), it made sense to bung
Energenie (#69) in as wells as this is a really simple shared device.
2016-04-01 12:57:17 +01:00

43 lines
1.3 KiB
ReStructuredText

=============
Input Devices
=============
.. currentmodule:: gpiozero
These input device component interfaces have been provided for simple use of
everyday components. Components must be wired up correctly before use in code.
.. note::
All GPIO pin numbers use Broadcom (BCM) numbering. See the :doc:`recipes`
page for more information.
Button
======
.. autoclass:: Button(pin, pull_up=True, bounce_time=None)
:members: wait_for_press, wait_for_release, pin, is_pressed, pull_up, when_pressed, when_released
Motion Sensor (D-SUN PIR)
=========================
.. autoclass:: MotionSensor(pin, queue_len=1, sample_rate=10, threshold=0.5, partial=False)
:members: wait_for_motion, wait_for_no_motion, pin, motion_detected, when_motion, when_no_motion
Light Sensor (LDR)
==================
.. autoclass:: LightSensor(pin, queue_len=5, charge_time_limit=0.01, threshold=0.1, partial=False)
:members: wait_for_light, wait_for_dark, pin, light_detected, when_light, when_dark
Distance Sensor (HC-SR04)
=========================
.. autoclass:: DistanceSensor(echo, trigger, queue_len=30, max_distance=1, threshold_distance=0.3, partial=False)
:members: wait_for_in_range, wait_for_out_of_range, trigger, echo, when_in_range, when_out_of_range, max_distance, distance, threshold_distance