mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Update sourcevalues docs as suggested in lurch's review
This commit is contained in:
13
docs/examples/source_value_processing.py
Normal file
13
docs/examples/source_value_processing.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from gpiozero import Button, LED
|
||||
from signal import pause
|
||||
|
||||
def opposite(values):
|
||||
for value in values:
|
||||
yield not value
|
||||
|
||||
led = LED(4)
|
||||
btn = Button(17)
|
||||
|
||||
led.source = opposite(btn.values)
|
||||
|
||||
pause()
|
||||
Reference in New Issue
Block a user