Advertisement
william200027

Porte avec code de dépannage

Oct 22nd, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. local pullEvent = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. idAVE = 2 -- Ordi Avant Arriere Escalier
  4. idGDE= 3 -- Ordi Gauche Droite Escalier
  5. idGDP = 4 -- Ordi Gauche Droite Planche
  6. idMDP = 5 -- Ordi Monter Dessante Planche
  7. idMDE = 6 -- Ordi Monter Dessante Escalier
  8.  
  9. rednet.open("back")
  10. term.setTextColor(colors.red)
  11. print("Veiller saisir l'Action:")
  12. term.setTextColor(colors.blue)
  13. print(". fermer")
  14. print(". ouvrir")
  15. print(". code")
  16. term.setTextColor(colors.gray)
  17. ONNN = "ouvrir"
  18. OFFF = "fermer"
  19. code = "R9"
  20. time = read()
  21.  
  22. if time == ONNN or time == OFFF or time == "code" then
  23.  if time == ONNN then
  24.    rednet.send(idAVE,"On")
  25.    rednet.send(idMDP,"On")
  26.    sleep(2)
  27.    rednet.send(idGDP,"On")
  28.    sleep(2)
  29.    rednet.send(idGDE,"On")
  30.    sleep(3)
  31.    rednet.send(idMDE,"On")
  32.    sleep(2)
  33.    os.reboot()
  34.  end
  35.  if time == OFFF then
  36.    rednet.send(idMDE,"Off")
  37.    sleep(1)
  38.    rednet.send(idGDE,"Off")
  39.    sleep(2)
  40.    rednet.send(idGDP,"Off")
  41.    sleep(2)
  42.    rednet.send(idMDP,"Off")
  43.    rednet.send(idAVE,"Off")
  44.    sleep(2)
  45.    os.reboot()
  46.  end
  47.  if time == "code" then
  48.    time = read("*")
  49.  if time == code then
  50.  else
  51.  os.reboot()
  52.  end
  53.  end
  54.  
  55.  else
  56.  os.reboot()
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement