Advertisement
nicx321

OC-Reactor control

May 3rd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local component = require("component")
  2. local term = require("term")
  3. local event = require("event")
  4. local rs = component.redstone
  5. local gpu = component.gpu
  6.  
  7. component.modem.open(123)
  8.  
  9. local y = 0
  10. local x
  11. local z
  12.  
  13. while true do
  14.   term.clear()
  15.   local _, _, from, port, _, message = event.pull("modem_message")
  16.   x=tostring(message)
  17.   print("cell ma: "..x.."%")
  18.  
  19.   if message>80 then
  20.     y=0
  21.     gpu.setBackground(0x00FF00)
  22.   end
  23.   if message<10 then
  24.     y=1
  25.     gpu.setBackground(0xFF0000)
  26.   end
  27.  
  28.   z= y*15
  29.  
  30.   rs.setOutput(4,z)
  31.   print(y)
  32.   print(z)
  33.   os.sleep(.1)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement