Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- local data
- local m = peripheral.wrap("back")
- local canStore
- --Functions
- function getData()
- data = m.get()
- canStore = data["Can Store Energy"]
- end
- function printData()
- getData()
- for i , j in pairs(data) do
- print(i..":"..tostring(j))
- end
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function check()
- getData()
- if canStore then
- turnOn()
- clear()
- print("Can store energy...")
- elseif data["Full Energy"] then
- turnOff()
- clear()
- print("Energy Full")
- else
- clear()
- print("Error!")
- end
- end
- function turnOn()
- redstone.setOutput("top", true)
- end
- function turnOff()
- redstone.setOutput("top", false)
- end
- --Main Program
- while true do
- getData()
- printData()
- check()
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment