SD_Ecliptica

Kensington Power

Dec 8th, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. local side = "bottom" -- TODO: check this value
  2. local port = 47838 -- TODO: check this value
  3.  
  4. local input
  5. local PORT = 0
  6. local energy = 0
  7.  
  8. print("Port " .. PORT .. " selected.")
  9.  
  10. -- wrap the modem
  11. local modem = peripheral.wrap("top")
  12. modem.open(PORT)
  13.  
  14. -- wrap the cell
  15. local cell = peripheral.wrap(side)
  16.  
  17. -- transmit messages
  18. while true do
  19.     term.clear()
  20.     term.setCursorPos(1,1)
  21.     energy = tostring(cell.getStored())
  22.     print("Sending value: " .. energy)
  23.     if (modem.isOpen(PORT)) then
  24.         modem.transmit(PORT, PORT, energy)
  25.     else
  26.         term.write("ERROR Connection closed")
  27.     end
  28.     sleep(5)
  29. end
Advertisement
Add Comment
Please, Sign In to add comment