Advertisement
Guest User

Untitled

a guest
Aug 29th, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. from time import time
  4.  
  5. NMOTORES=16
  6. TAPAGADO=35*60*1000
  7.  
  8. motores=[None]*NMOTORES  ### Inicialización
  9.  
  10. def apagaMotor(NumeroMotor):
  11.     pass
  12.  
  13. def enciendeMotor():
  14.     return numeroMotor, time() # devuelve numero de motor y timestamp o None/None si no hay mas motores a encender
  15.  
  16. while True:
  17.  
  18.     numeroMotor=0
  19.     while numeroMotor is not None:
  20.         numeroMotor, hora = enciendeMotor()
  21.         motores[numeroMotor]=hora
  22.  
  23.     i = 0
  24.     for motor in motores:
  25.         if motor is not None:
  26.               if (motor-time())>=TAPAGADO:
  27.                   apagaMotor(i)
  28.                   motores[i]=None
  29.         i+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement