Advertisement
1ng0

CC - BigReactor Control by Pyramidalist 2/2 Multiturbine

Nov 28th, 2015
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. -----------------------------------------------------
  2. --                                                 --
  3. --  Pyramidalist                                   --
  4. --                                                 --
  5. --  https://www.youtube.com/watch?v=BhOBAZqCI1g    --
  6. --                         --
  7. -----------------------------------------------------
  8.  
  9. local reactor
  10. reactor = peripheral.wrap("back")
  11.  
  12. counter = 0
  13. term.clear()
  14. akkut = 0
  15. print("")
  16. Consum = 0
  17.  
  18. print("SOLL-Temperatur eingeben")
  19.  
  20. while true do
  21.  
  22. Tastatur = "nixdrin"
  23. local event, Tastatur = os.pullEvent("key")
  24. if Tastatur == "nixdrin" then
  25.    -- print("nix eingegeben")
  26. else
  27.    -- print("haha", tostring(Tastatur))
  28.    print("Neue SOLL-Temperatur")
  29.    local eingabe = read("")
  30.    -- print(eingabe,"XXXX")
  31.    SOLLtemp = tonumber(eingabe)
  32.    print("Neue SOLL-Temperatur gesetzt")
  33.    print(SOLLtemp)
  34.  
  35. end
  36.  
  37.  
  38.  
  39.  
  40. dauer = 1
  41. rednet.open("top")
  42. while dauer < 200 do -- Sendung so lange wiederholen, bis Wahrscheinlich angekommen (Feedback baue ich noch?)
  43. rednet.broadcast(SOLLtemp)
  44. -- print("Dauer = ",dauer)
  45. dauer = dauer + 1
  46. sleep(0.1)
  47. end
  48. print("gesendet")
  49.  
  50. rednet.close("top")
  51.  
  52. term.clear()
  53. term.setCursorPos(0,0)
  54. print("")
  55.  
  56. akkut = akkut + reactor.getFuelTemperature()
  57.  
  58. Consum = Consum + reactor.getFuelConsumedLastTick()
  59.  
  60. counter = counter + 1
  61. print("Anzahl der Messungen: ", counter)
  62. print("Durchschnittstemperatur: ",akkut/counter)
  63. print("Durchschnittsverbrauch : ", Consum/counter)
  64. print("SOLL-Temperatur eingeben wenn noetig")
  65. sleep(0.5)
  66.  
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement