Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from time import time
- NMOTORES=16
- TAPAGADO=35*60*1000
- motores=[None]*NMOTORES ### Inicialización
- def apagaMotor(NumeroMotor):
- pass
- def enciendeMotor():
- return numeroMotor, time() # devuelve numero de motor y timestamp o None/None si no hay mas motores a encender
- while True:
- numeroMotor=0
- while numeroMotor is not None:
- numeroMotor, hora = enciendeMotor()
- motores[numeroMotor]=hora
- i = 0
- for motor in motores:
- if motor is not None:
- if (motor-time())>=TAPAGADO:
- apagaMotor(i)
- motores[i]=None
- i+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement