CCCPaste

tankdatameasure

-- Tank Data Gathering Program --
-- pastebin get ZcmLW62N startup


-- config--

local chn = 100   -- channel to broadcast on, using 100s for refinery
local mside = "bottom" -- change to what side modem is on
local tside = "top" -- change to what side tanks are on

-- peripherals and variables --
tank = peripheral.wrap(tside)
modem = peripheral.wrap(mside)


-- functions --

function cl()
	term.clear()
	term.setCursorPos(1,1)
end

function measure()
	cl()
	data = tank.getMetadata()
	print("Measuring fluid levels...")
	sleep(1)
	modem.transmit(chn, 999, data)
	cl()
	print("Transmitting data on channel " .. chn .. "...")
	sleep(1)
	
end

-- rednet --

modem.open(chn)

if open == false then
	cl()
	print("Opening modem...")
	rednet.open(Mside)
	sleep(0.5)
end

-- Main Code --

while true do
	measure()
end