Add more advanced and remote recipes

This commit is contained in:
Ben Nuttall
2017-07-17 02:03:29 +01:00
parent 957bb788ea
commit 220da280ba
16 changed files with 290 additions and 11 deletions

View File

@@ -1,12 +1,12 @@
from gpiozero import LEDBoard, MotionSensor
from gpiozero.pins.pigpio import PiGPIOPin
from gpiozero.pins.pigpio import PiGPIOFactory
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]
remotes = [PiGPIOFactory(host=ip) for ip in ips]
leds = LEDBoard(2, 3, 4, 5) # leds on this pi
sensors = [MotionSensor(pin) for pin in remote_pins] # motion sensors on other pis
sensors = [MotionSensor(17, pin_factory=r) for r in remotes] # remote sensors
for led, sensor in zip(leds, sensors):
led.source = sensor.values