Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- prox = sensor.wrap("left")
- rednet.open("back")
- local target = prox.getTargets()
- local consumati = 0
- local shunt
- for tarName, _ in pairs(target) do
- local details = prox.getTargetDetails(tarName)
- if details["RawName"] == "tile.blockaveragecounter" then
- shunt = tarName;
- end
- end
- if shunt == nil then
- os.exit()
- end
- while true do
- local details = prox.getTargetDetails(shunt)
- consumo = tostring(math.floor((details["EnergyEmitted"]-consumati)/21)).."Kw"
- rednet.send(2,consumo)
- consumati = details["EnergyEmitted"]
- if rs.testBundledInput ("bottom", colors.lime) == true then
- rs.setBundledOutput("bottom", colors.black)
- else
- rs.setBundledOutput("bottom" , 0)
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment