mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
19 lines
463 B
Python
19 lines
463 B
Python
from gpiozero import PingServer, StatusZero
|
|
from gpiozero.tools import negated
|
|
from signal import pause
|
|
|
|
status = StatusZero('mum', 'dad', 'alice')
|
|
|
|
statuses = {
|
|
PingServer('192.168.1.5'): status.mum,
|
|
PingServer('192.168.1.6'): status.dad,
|
|
PingServer('192.168.1.7'): status.alice,
|
|
}
|
|
|
|
for server, leds in statuses.items():
|
|
leds.green.source = server.values
|
|
leds.green.source_delay = 60
|
|
leds.red.source = negated(leds.green.values)
|
|
|
|
pause()
|