mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Add toggle to boards
This commit is contained in:
		| @@ -25,6 +25,10 @@ class TrafficLights(object): | ||||
|         for led in self._leds: | ||||
|             led.off() | ||||
|  | ||||
|     def toggle(self): | ||||
|         for led in self._leds: | ||||
|             led.toggle() | ||||
|  | ||||
|     def blink(self, on_time=1, off_time=1): | ||||
|         for led in self._leds: | ||||
|             led.blink(on_time, off_time) | ||||
| @@ -56,12 +60,19 @@ class FishDish(TrafficLights): | ||||
|         for thing in self._all: | ||||
|             thing.off() | ||||
|  | ||||
|     def toggle(self): | ||||
|         for thing in self._all: | ||||
|             thing.toggle() | ||||
|  | ||||
|     def lights_on(self): | ||||
|         super(FishDish, self).on() | ||||
|  | ||||
|     def lights_off(self): | ||||
|         super(FishDish, self).off() | ||||
|  | ||||
|     def toggle_lights(self): | ||||
|         super(FishDish, self).toggle() | ||||
|  | ||||
|  | ||||
| class TrafficHat(FishDish): | ||||
|     def __init__(self): | ||||
| @@ -89,6 +100,10 @@ class PiLiter(object): | ||||
|         for led in self._leds: | ||||
|             led.off() | ||||
|  | ||||
|     def toggle(self): | ||||
|         for led in self._leds: | ||||
|             led.toggle() | ||||
|  | ||||
|     def blink(self, on_time=1, off_time=1): | ||||
|         for led in self._leds: | ||||
|             led.blink(on_time, off_time) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user