SHARE
TWEET

Untitled

a guest Aug 29th, 2017 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top