Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local side = "bottom" -- TODO: check this value
- local port = 47838 -- TODO: check this value
- local input
- local PORT = 0
- local energy = 0
- print("Port " .. PORT .. " selected.")
- -- wrap the modem
- local modem = peripheral.wrap("top")
- modem.open(PORT)
- -- wrap the cell
- local cell = peripheral.wrap(side)
- -- transmit messages
- while true do
- term.clear()
- term.setCursorPos(1,1)
- energy = tostring(cell.getStored())
- print("Sending value: " .. energy)
- if (modem.isOpen(PORT)) then
- modem.transmit(PORT, PORT, energy)
- else
- term.write("ERROR Connection closed")
- end
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment