mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Docs updates: add installing, advanced recipes, remote gpio and remote recipes - wip
This commit is contained in:
14
docs/examples/multi_room_doorbell.py
Normal file
14
docs/examples/multi_room_doorbell.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from gpiozero import Buzzer, Button
|
||||
from gpiozero.pins.pigpio import PiGPIOPin
|
||||
from signal import pause
|
||||
|
||||
ips = ['192.168.1.3', '192.168.1.4', '192.168.1.5', '192.168.1.6']
|
||||
remote_pins = [PiGPIOPin(17, host=ip) for ip in ips]
|
||||
|
||||
button = Button(17) # button on this pi
|
||||
buzzers = [Buzzer(pin) for pin in remote_pins] # buzzers on remote pins
|
||||
|
||||
for buzzer in buzzers:
|
||||
buzzer.source = button.values
|
||||
|
||||
pause()
|
||||
Reference in New Issue
Block a user