791 Commits

Author SHA1 Message Date
Ben Nuttall
2172ed78db Add missing Buzzer import 2015-09-21 17:44:45 +01:00
Ben Nuttall
2de3d9a26b Merge pull request #18 from Gadgetoid/patch-1
Update __init__.py
2015-09-21 17:33:56 +01:00
Ben Nuttall
4403348917 Use super over re-implentation for PiTraffic 2015-09-21 17:30:11 +01:00
Ben Nuttall
8223e56162 Make FishDish Button pull down 2015-09-21 17:18:20 +01:00
Ben Nuttall
d5f3e849a4 Prefix lights and all properties and convert lists to tuples 2015-09-21 17:14:33 +01:00
Philip Howard
9019452973 Update __init__.py
Added rogue missing comma!
2015-09-21 17:00:09 +01:00
Ben Nuttall
5669a98b42 Expose add-on board classes to the module 2015-09-21 15:29:54 +01:00
Ben Nuttall
6d29aaa590 Implement common add-on boards, re: #17 2015-09-21 15:28:01 +01:00
Ben Nuttall
4d7f9eeeb3 Merge pull request #16 from waveform80/when-light-when-dark
When light when dark
2015-09-21 13:26:00 +01:00
Dave Jones
9c64a1dc2f Update the docs with an example
Simple demo of when_dark / when_light
2015-09-21 12:04:51 +01:00
Dave Jones
e9a970ae5c Experiment with LightSensor
Remove wait_for_input, add_callback and remove_callback from the base
InputDevice class and add specific things for LightSensor:
wait_for_light and wait_for_dark to wait on those events occurring, and
when_light and when_dark which can be set to callbacks to call on those
events occurring.
2015-09-21 11:57:50 +01:00
Ben Nuttall
2c0fb7eada Merge pull request #15 from waveform80/doc-tidy
Doc corrections
2015-09-21 11:28:57 +01:00
Ben Nuttall
a07f89c561 Release v0.2.0 v0.2.0 2015-09-21 11:20:21 +01:00
Ben Nuttall
6c98086bff Remove callback before adding a new one 2015-09-21 11:19:21 +01:00
Dave Jones
4a8e17deac Doc corrections
Tidy up wrapping and replace all references to gpio_components with
gpiozero
2015-09-21 08:33:03 +01:00
Ben Nuttall
9219b01081 Merge pull request #14 from waveform80/light-sensor-queue
Light sensor queue
2015-09-20 22:28:00 +01:00
Ben Nuttall
3900827734 Merge pull request #13 from waveform80/fix-threads
Shut down GPIO threads nicely
2015-09-20 22:27:36 +01:00
Dave Jones
0d7c7e28fc Lots of fixes
* Move `is_active` to `GPIODevice`; it's equally applicable to inputs
  and outputs so there's no point having it just in inputs
* Flip the pull-up status for `MotionSensor` (it was backwards leading
  to reversed readings from the sensor)
* Add a `threshold` to `MotionSensor` (optional), and `value` (similar
  to `LightSensor`)
* Also expose `pull_up` as a simple bool property
* Rejig `LightSensor` so it also derives from `InputDevice` (it inherits
  enough to make it worthwhile) and so that its API is similar to
  `MotionSensor` (a `value` property with a `*_detected` property, and a
  background threaded queue which constantly monitors values)
2015-09-20 19:41:19 +01:00
Dave Jones
14f9d843e3 Merge branch 'fix-threads' 2015-09-18 13:08:12 +01:00
Dave Jones
e2ddad6fea Shut down GPIO threads nicely
The motion sensor queue doesn't shut down properly at script end at the
moment and prevents the interpreter shutting down. This is because it's
a non-daemon thread so `__del__` never gets run and so on.

This is a bit of a major PR - I can split it up if you want. Firstly it
makes a common base class called `GPIODevice` for both `InputDevice` and
`OutputDevice`. This just takes care of the read-only pin stuff. Next it
makes a `GPIOThread` class that ensures its a daemon thread, and which
also ensures proper cleanup on shutdown.

Finally, it fixes `MotionSensor` to use the new `GPIOThread` class
(tested this time! Works nicely) and adds the `blink` method to the
`LED` class (which also works nicely this time).
2015-09-18 12:45:30 +01:00
Ben Nuttall
c810730cf5 Merge pull request #11 from waveform80/auto-cleanup
Ensure GPIO.cleanup is called
2015-09-17 22:21:57 +01:00
Dave Jones
481193497a Ensure GPIO.cleanup is called
Small patch to ensure GPIO.cleanup is always called on interpreter
shutdown. This just means the library will "play nice" with whatever
comes afterward.
2015-09-17 18:51:56 +01:00
Ben Nuttall
4c2796e0da Merge pull request #9 from waveform80/pin-read-only
Fix #8
2015-09-17 11:11:51 +01:00
Dave Jones
1219d99ded Fix #8
Make the pin property a read-only property
2015-09-17 10:50:23 +01:00
Ben Nuttall
61e15868e9 Add detail to readme 2015-09-15 19:12:08 +01:00
Ben Nuttall
491e6d8feb Merge branch 'waveform80-motion-queue' 2015-09-15 17:58:06 +01:00
Ben Nuttall
df1eb2dffd Merge branch 'motion-queue' of git://github.com/waveform80/gpio-zero into waveform80-motion-queue 2015-09-15 17:57:43 +01:00
Ben Nuttall
5f65ec739b Update links to repo 2015-09-15 17:57:14 +01:00
Ben Nuttall
a8b93cf97f Add setup.py and distribution basics 2015-09-15 17:53:50 +01:00
Ben Nuttall
abdc215175 Rename to gpiozero and tidy up 2015-09-15 17:53:08 +01:00
Dave Jones
065b5aa40d Draft of a queue implementation for MotionSensor
This is a quick *untested* implementation of a background threaded
queue for `MotionSensor`. The optional *queue_len* is the number of
values to store in the queue, *sample_rate* is the number of times per
second to query the motion sensor, and if *partial* is False (the
default) then the `motion_detected` property won't return anything until
the queue has been filled.
2015-09-15 16:02:16 +01:00
Ben Nuttall
90aed0e925 Merge pull request #1 from waveform80/cleanup
Minor clean-up
2015-09-15 10:08:05 +01:00
Dave Jones
b87bb0c4c3 Minor clean-up
Expand gitignore to include the usual py developing stuff, add an
__init__ to make this a legitimate package, move GPIO initialization
into the package init, import all stuff from input and output devices in
the package to enable the access demonstrated in the example, remove a
duplicate method from LightSensor, and make motion_detected a property
(for consistency with is_active which it presumably parallels).
2015-09-15 08:43:13 +01:00
Ben Nuttall
5b99e69e9b Make is_active a property 2015-09-14 21:29:39 +01:00
Ben Nuttall
d11f9725e5 Implement TemperatureSesnor and Motor and expand readme 2015-09-14 21:01:24 +01:00
Ben Nuttall
f548729676 Add MotionSensor 2015-09-14 15:54:54 +01:00
Ben Nuttall
d802e2d89a Add components to readme 2015-09-14 13:58:35 +01:00
Ben Nuttall
3e52078450 Add wait_for_input and add_callback methods to InputDevice 2015-09-14 13:46:08 +01:00
Ben Nuttall
4d19a10547 Add basic version of code 2015-09-14 11:04:39 +01:00
Ben Nuttall
95118e504d Ignore *.pyc 2015-09-14 11:04:18 +01:00
Ben Nuttall
272747238f Initial commit 2015-09-14 10:36:03 +01:00