Advertisement
Guest User

Privat control system

a guest
Jul 24th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.86 KB | None | 0 0
  1.    
  2.  
  3.     local aps2 = 0
  4.     local aps = 0
  5.     local ppc = 0
  6.     local re1 = 0
  7.     local re2 = 0
  8.     local re3 = 0
  9.     local re4 = 0
  10.     local pe = 0
  11.     local ph = 0
  12.     local aee = 0
  13.     rednet.open("back")
  14.     m = peripheral.wrap("top")
  15.     while true do
  16.      
  17.       id, mes , prot1= rednet.receive()
  18.      
  19.       if id == 811 then
  20.         ph = mes
  21.       elseif id == 1179 then
  22.         aee = mes
  23.       elseif id == 930 then
  24.         pe = mes
  25.       elseif id == 1180 then
  26.         re1 = mes
  27.       elseif id == 1181 then
  28.         re2 = mes
  29.       elseif id == 1182 then
  30.         re3 = mes
  31.       elseif id == 1183 then
  32.         re4 = mes
  33.       elseif id == 790 then
  34.         ppc = mes
  35.       elseif id == 1184 then
  36.         aps = mes
  37.       elseif id == 1185 then
  38.         aps2 = mes
  39.       end
  40.      
  41.       print(id)
  42.       m.clear()
  43.       m.setCursorPos(10,1)
  44.       m.write("Home Control")
  45.       m.setCursorPos(1,4)
  46.       m.write("pressure chamber pres.")
  47.       if ppc >= 5 then
  48.         m.write("!OVERLOAD!")
  49.       elseif ppc <= 4.9 and ppc >= 0.2 then
  50.         m.write(ppc)
  51.       elseif ppc <= 0 then
  52.         m.write("LOW PRESSURE")
  53.       end
  54.       m.setCursorPos(1,5)
  55.       m.write("pressure Home: ")
  56.       if ph >= 14 then
  57.         m.write("!!!OVERLOAD!!!")
  58.       elseif ph <= 13.5 and ph >= 0.5 then
  59.         m.write(ph)
  60.       elseif ph <= 0 then
  61.         m.write("LOW PRESSURE")
  62.       end
  63.       m.setCursorPos(1,7)
  64.       m.write("ME-system power: ")
  65.       m.write(aee/1000000)
  66.       m.write(" Mio.")
  67.      
  68.       m.setCursorPos(1,9)
  69.       m.write("Pressure Elevator: ")
  70.       if pe >= 5 then
  71.         m.write("!OVERLOAD!")
  72.       elseif pe <= 4.9 and pe >= 0.1 then
  73.         m.write(pe)
  74.       elseif pe <= 0 then
  75.         m.write("LOW PRESSURE")  
  76.       end
  77.      
  78.       m.setCursorPos(1,12)
  79.       m.write("Reso. Energy[1]: ")
  80.       m.write(re1/1000000)
  81.       m.write(" Mio.")
  82.      
  83.       m.setCursorPos(1,13)
  84.       m.write("Reso. Energy[2]: ")
  85.       m.write(re2/1000000)
  86.       m.write(" Mio.")
  87.      
  88.       m.setCursorPos(1,14)
  89.       m.write("Reso. Energy[3]: ")
  90.       m.write(re3/1000000)
  91.       m.write(" Mio.")
  92.      
  93.       m.setCursorPos(1,15)
  94.       m.write("Reso. Energy[4]: ")
  95.       m.write(re4/1000000)
  96.       m.write(" Mio.")
  97.      
  98.       m.setCursorPos(1,16)
  99.       m.write("-----------------------")
  100.      
  101.       m.setCursorPos(1,17)
  102.       m.write("Energy gesamt:  ")
  103.       m.write(re1/1000000+re2/1000000+re3/1000000+re4/1000000)
  104.       m.write(" Mio.")
  105.      
  106.       m.setCursorPos(1,19)
  107.       m.write("Me-System [Items] :  ")
  108.       m.setCursorPos(1,20)
  109.       m.write("free       /total ")
  110.       m.setCursorPos(1,21)
  111.       m.write(aps)
  112.      
  113.       m.setCursorPos(1,23)
  114.       m.write("Me-System [Types] : ")
  115.       m.setCursorPos(1,24)
  116.       m.write("free /total ")
  117.       m.setCursorPos(1,25)
  118.       m.write(aps2)    
  119.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement