This commit is contained in:
Jonas Zeunert
2022-08-31 17:28:24 +02:00
parent 52bfa8c6fe
commit 5fb8bb54f0
2 changed files with 18 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
from lamps.Lamp import Lamp
from itertools import cycle
import random
import time
class LampGroup:
@@ -39,6 +40,11 @@ class LampGroup:
self.currentLampPtr -= 1
def toggleRandom(self, sleepTime):
random_lamp = random.choice(self.lamps)
random_lamp.activate()
time.sleep(sleepTime)
random_lamp.deactivate()
def cycle(self):
if self.currentLamp:
self.currentLamp.deactivate()