Advertisement
rito_kun

Serveur d'envoi

Nov 9th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. rednet.open("bottom")
  2. turbine = peripheral.wrap("top")
  3. rpmTurbine = "null"
  4. rfTurbine = "null"
  5. temp = "null"
  6. print("En attente...")
  7.  
  8. local idServer = 5
  9.  
  10. function detect()
  11. rpmTurbine = math.floor(turbine.getRotorSpeed())
  12. rfTurbine = math.floor(turbine.getEnergyProducedLastTick())
  13.  
  14. id,temp = rednet.receive()
  15. end
  16.  
  17. while true do
  18.  
  19. if temp == "RPM" then
  20. rpmTurbine = math.floor(turbine.getRotorSpeed())
  21. rednet.send(idServer,rpmTurbine)
  22. temp = "null"
  23. end
  24.  
  25. if temp == "rf" then
  26. rfTurbine = math.floor(turbine.getEnergyProducedLastTick())
  27. rednet.send(idServer,rfTurbine)
  28. temp = "null"
  29. end
  30.  
  31. if temp == "null" then
  32. term.clear()
  33. term.setCursorPos(1,1)
  34. print("Envoi donnees de Turbine 1 : ID : 7")
  35. print("")
  36. print(rpmTurbine.." RPM")
  37. print(rfTurbine.." RF/T")
  38. detect()
  39. end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement