mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			548 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			548 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from gpiozero import PingServer, LEDBoard
 | |
| from gpiozero.tools import negated
 | |
| from signal import pause
 | |
| 
 | |
| status = LEDBoard(
 | |
|     mum=LEDBoard(red=14, green=15),
 | |
|     dad=LEDBoard(red=17, green=18),
 | |
|     alice=LEDBoard(red=21, green=22)
 | |
| )
 | |
| 
 | |
| 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()
 |